Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created May 14, 2016 00:37
Show Gist options
  • Save tmcw/412f34b2c5ff906ffa27fe2e1d89cfb0 to your computer and use it in GitHub Desktop.
Save tmcw/412f34b2c5ff906ffa27fe2e1d89cfb0 to your computer and use it in GitHub Desktop.
var fs = require('fs');
var plants = JSON.parse(fs.readFileSync('./plants.geojson'));
var output = {
type: 'FeatureCollection',
features: plants.features.map(feature => {
return {
type: 'Feature',
geometry: feature.geometry,
properties: {
n: feature.properties.Plant_Name,
t: feature.properties.Total_MW,
c: feature.properties.Coal_MW,
ng: feature.properties.NG_MW,
h: feature.properties.Hydro_MW,
s: feature.properties.Solar_MW,
w: feature.properties.Wind_MW
}
}
})
};
fs.writeFileSync('./plants.min.json', JSON.stringify(output));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment