Last active
January 23, 2018 10:13
-
-
Save wmucheru/982da1e777dcb7d030c4692e8aa3ca2c to your computer and use it in GitHub Desktop.
Pick the property values from an existing GeoJSON, output as json string
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
let features = sourceJSON.features, | |
newFeatures = []; | |
features.map((feature, index) => { | |
let properties = feature.properties, | |
ft = { | |
geometry: feature.geometry, | |
properties: { | |
continent: properties.continent, | |
iso_code: properties.iso_a2, | |
name: properties.name | |
}, | |
type: feature.type | |
}; | |
newFeatures.push(ft); | |
return; | |
}) | |
let geojson = { type: "FeatureCollection", features: newFeatures }; | |
console.log(JSON.stringify(geojson)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment