Created
June 18, 2017 23:40
-
-
Save stephanbogner/48f2164cf44aed8d57fa3359932c70a6 to your computer and use it in GitHub Desktop.
Take a geojson feature as file and returns its circumference/length
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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