Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mapsam
Last active January 12, 2019 01:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mapsam/7320ccb2aba0ac372050 to your computer and use it in GitHub Desktop.
Save mapsam/7320ccb2aba0ac372050 to your computer and use it in GitHub Desktop.
javascript geojson creation loop
var geojson = {};
geojson['type'] = 'FeatureCollection';
geojson['features'] = [];
for (var k in data) {
var newFeature = {
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [parseFloat(data[k].lng), parseFloat(data[k].lon)]
},
"properties": {
"title": data[k].title,
"description": data[k].desc
}
}
geojson['features'].push(newFeature);
}
@TheMapSmith
Copy link

there's a missing [ on line 10 😄

@mapsam
Copy link
Author

mapsam commented Jan 12, 2019

fixed! 😄

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