Skip to content

Instantly share code, notes, and snippets.

@stephanbogner
Created June 18, 2017 23:40
Show Gist options
  • Save stephanbogner/48f2164cf44aed8d57fa3359932c70a6 to your computer and use it in GitHub Desktop.
Save stephanbogner/48f2164cf44aed8d57fa3359932c70a6 to your computer and use it in GitHub Desktop.
Take a geojson feature as file and returns its circumference/length
var fs = require('fs');
var turf = require('turf');
fs.readFile('feature.geojson', 'utf8', function (err,data) {
if (err) {
return console.log(err);
}
var feature = JSON.parse(data);
var length = turf.lineDistance(feature);
console.log(length + 'km');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment