Last active
January 12, 2019 01:10
-
-
Save mapsam/7320ccb2aba0ac372050 to your computer and use it in GitHub Desktop.
javascript geojson creation loop
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 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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
there's a missing
[
on line 10 😄