Created
October 26, 2013 16:08
-
-
Save vgeorge/7171223 to your computer and use it in GitHub Desktop.
A NodeJS script to extract the outer ring of GeoJSON polygons
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') | |
, _ = require('underscore') | |
, file = require('./input.json') | |
_.each(file.features, function(feature, index){ | |
file.features[index].geometry.coordinates = [feature.geometry.coordinates[0]] | |
console.log(index) | |
}) | |
fs.writeFile('output.geojson', JSON.stringify(file), function(err){ | |
if(err) { | |
console.log(err); | |
} else { | |
console.log("File created successfully!"); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you have a sample project which uses this script?