Skip to content

Instantly share code, notes, and snippets.

@vgeorge
Created October 26, 2013 16:08
Show Gist options
  • Save vgeorge/7171223 to your computer and use it in GitHub Desktop.
Save vgeorge/7171223 to your computer and use it in GitHub Desktop.
A NodeJS script to extract the outer ring of GeoJSON polygons
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!");
}
})
@cvazquezlos
Copy link

Do you have a sample project which uses this script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment