0.4.0 • Published 10 years ago

convert-geo v0.4.0

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

convert-geo

Build Status

converting multi-format to geojson.

Install

npm install convert-geo

Support

  • kml
  • topojson
  • gpx
  • csv
  • tsv
  • osm xml

convert to geojson :).

example

For converting kml, topojson, gpx, osm xml format is quite simple

var cv_geojson = require('..');

cv_geojson({
    input: __dirname + '/test.kml' // input file
  }, function(err, result) {
    if(err) {
      console.error(err); // it should be null if it success.
    }else {
      console.log(result); // result will be the geojson
    }
  
  }
);

for csv, tsv you will need to pass an options in the object. For telling the converter, which field is latitude, which field is longitude

var cv_geojson = require('..');

cv_geojson({
    input: __dirname + '/test.csv' // input file
    options: { 
        // latitude
        latfield: 'LATFIELDNAME',
        // longitude
        lonfield: 'LONFIELDNAME'
    }
  }, function(err, result) {
    if(err) {
      console.error(err); // it should be null if it success.
    }else {
      console.log(result); // result will be the geojson
    }
  
  }
);

Reference:

License

MIT @chilijung

0.4.0

10 years ago

0.3.3

10 years ago

0.3.2

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago