Created
March 25, 2015 01:37
-
-
Save kapadia/262d54196bd2db2ce2c9 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env node | |
var turf = require('turf'); | |
function usage() { | |
console.log('Usage: ./buffer-point [lat] [lng] [distance]\n'); | |
} | |
process.argv.shift(); | |
process.argv.shift(); | |
if (process.argv.length !== 3) { | |
usage(); | |
process.exit(1); | |
} | |
var lat = process.argv.shift(); | |
var lng = process.argv.shift(); | |
var distance = process.argv.shift(); | |
var point = { | |
"type": "Feature", | |
"properties": {}, | |
"geometry": { | |
"type": "Point", | |
"coordinates": [lat, lng] | |
} | |
}; | |
var unit = 'kilometers'; | |
var buffered = turf.buffer(point, distance, unit); | |
var features = buffered.features.concat(point); | |
var result = { | |
"type": "FeatureCollection", | |
"features": features | |
}; | |
console.log(JSON.stringify(result)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
e.g.