-
-
Save jasonbell/fc937d5f3da61678becb929bf837f42c to your computer and use it in GitHub Desktop.
Create a GeoJSON structure in for loop
This file contains hidden or 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