csv-geojson-conv
v1.0.0-beta.3
Published
ESM/CJS module to convert CSV string to GeoJSON in node.js or browser
Downloads
2
Readme
csv-geojson-conv
csv-geojson-conv is module for very easy to use for convert from CSV to GeoJSON.
no more spend your time
install
# via npm
npm install csv-geojson-conv
# via yarn
yarn add csv-geojson-conv
HOW TO USE
via browser fetch method
import csvToGeojson from 'csv-geojson-conv';
//or
const csvToGeojson = require('csv-geojson-conv');
fetch('data/repeater.csv').then(async res => {
const csvdata = await res.text();
if (csvdata) {
const geojson = csvToGeojson(csvdata)
}
});
this is sample csv file.
Latitude,Longitude,name,point,notes
37.4355672,126.9388092,Seoul-1,99.9,-
35.0819546,129.0552017,Busan-2,88.8,
if column names are different like that in your CSV.
you can use with this options
const geojson = csvToGeojson(csvdata, { latitudeColumnName: 'lat', longitudeColumnName: 'lon' })
LICENSE
Licensed [MIT](https://github.com/Jeongyong-park/csv-geojson-convmocha/blob/master/LICENSE