{"id":13426219,"url":"https://github.com/mapbox/csv2geojson","last_synced_at":"2025-03-15T21:30:47.244Z","repository":{"id":4159001,"uuid":"5273411","full_name":"mapbox/csv2geojson","owner":"mapbox","description":"magically convert csv files to geojson files","archived":false,"fork":false,"pushed_at":"2022-09-14T21:09:37.000Z","size":212,"stargazers_count":360,"open_issues_count":15,"forks_count":82,"subscribers_count":136,"default_branch":"gh-pages","last_synced_at":"2024-06-11T17:12:21.702Z","etag":null,"topics":["banished"],"latest_commit_sha":null,"homepage":"http://mapbox.github.io/csv2geojson/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-02T14:21:55.000Z","updated_at":"2024-06-11T17:12:21.702Z","dependencies_parsed_at":"2023-01-11T16:34:57.685Z","dependency_job_id":null,"html_url":"https://github.com/mapbox/csv2geojson","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fcsv2geojson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fcsv2geojson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fcsv2geojson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fcsv2geojson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/csv2geojson/tar.gz/refs/heads/gh-pages","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243792290,"owners_count":20348610,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["banished"],"created_at":"2024-07-31T00:01:29.299Z","updated_at":"2025-03-15T21:30:46.909Z","avatar_url":"https://github.com/mapbox.png","language":"JavaScript","readme":"[![Build Status](https://travis-ci.org/mapbox/csv2geojson.png)](https://travis-ci.org/mapbox/csv2geojson)\n\n# csv2geojson\n\nConverts [CSV](http://en.wikipedia.org/wiki/Comma-separated_values) and [TSV](http://en.wikipedia.org/wiki/Tab-separated_values)\nfiles into [GeoJSON](http://www.geojson.org/) data suitable for maps..\n\n## Using as a binary:\n\n    npm install -g csv2geojson\n    csv2geojson geodata.csv \u003e geodata.geojson\n\n```\n➟ csv2geojson\nUsage: csv2geojson --lat [string] --lon [string] --line [boolean] --delimiter [string] FILE\n\nOptions:\n  --lat        the name of the latitude column\n  --lon        the name of the longitude column\n  --line       whether or not to output points as a LineString  [default: false]\n  --delimiter  the type of delimiter                            [default: \",\"]\n  --numeric-fields comma separated list of fields to convert to numbers\n```\n\n## Using in nodejs\n\n    npm install --save csv2geojson\n\n```js\nvar csv2geojson = require('csv2geojson');\n\nvar geoJson = csv2geojson.csv2geojson(csvString, function(err, data) {\n    // err has any parsing errors\n    // data is the data.\n});\n```\n\n## api\n\n```js\ncsv2geojson.csv2geojson(csvString, {\n    latfield: 'LATFIELDNAME',\n    lonfield: 'LONFIELDNAME',\n    delimiter: ','\n}, function(err, data) {\n});\n```\n\nParse a CSV file and derive a [GeoJSON](http://www.geojson.org/) \n[`FeatureCollection`](http://geojson.org/geojson-spec.html#feature-collection-objects)\nobject from it. Err is non-falsy if latitude and longitude values cannot be \ndetected or if there are invalid rows in the file. Delimiter can be ',' \nfor CSV or '\\t' for TSV or '|' and other delimiters.\n\nDelimiter can also be `auto`, and it will try `, \\t | ;` and choose the 'best'.\n\n```js\ncsv2geojson.dsv(delimiter).parse(dsvString);\n```\n\nThe [dsv](https://github.com/mbostock/dsv) library for barebones DSV parsing.\n\n```js\ncsv2geojson.auto(dsvString);\n```\n\nAutomatically choose a delimiter to parse a dsv string with, and do it.\n\n```js\ncsv2geojson.toPolygon(gj);\ncsv2geojson.toLine(gj);\n```\n\nGiven a GeoJSON file consisting of points, derive one consisting of a polygon\nor line that has the coordinates of those points, in the order given.\n\n## Using in webpages\n\nThe latest build will be at\n\n    https://npmcdn.com/csv2geojson@latest/csv2geojson.js\n\nOpen that path in a browser to be redirected to the lastest pinned version.\n\nLooks for fields like `/^Lat/i`.\n\n## See Also\n\n* [topojson](https://github.com/mbostock/topojson/) supports joining data in CSV\n* [gdal](http://www.gdal.org/) supports specific CSV structures to and from other data formats\n\nThis is what powers the CSV/TSV import of [geojson.io](http://geojson.io/).\n","funding_links":[],"categories":["JavaScript","others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fcsv2geojson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Fcsv2geojson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fcsv2geojson/lists"}