Created
April 15, 2016 01:37
-
-
Save trillerpfeife/561e6fa277cf086da7404e6a7a37c59d to your computer and use it in GitHub Desktop.
geojson converter for oeamtc.at array
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 oldGeo = [{ | |
'name': 'Wels', | |
'address': '', | |
'number': '', | |
'zip': '4600', | |
'city': 'Wels', | |
'lat': '48.19043815', | |
'lon': '14.07081485', | |
'urls': [{ | |
'cat': 'Raststationen', | |
'url': '$(\'#ajaxkeyword,#poi\').find(\'input[name=\\\'mdoc_id\\\']\').val(\'1367068\');$(\'#ajaxkeyword,#poi\').submit();' | |
}] | |
}, { | |
'name': 'Brennersee', | |
'address': '', | |
'number': '', | |
'zip': '6156', | |
'city': 'Gries am Brenner', | |
'lat': '47.0144393', | |
'lon': '11.5059042', | |
'urls': [{ | |
'cat': 'Raststationen', | |
'url': '$(\'#ajaxkeyword,#poi\').find(\'input[name=\\\'mdoc_id\\\']\').val(\'1322883\');$(\'#ajaxkeyword,#poi\').submit();' | |
}] | |
}]; | |
var newGeo = { | |
'type': 'FeatureCollection', | |
'features': [] | |
}; | |
function feature(y, x, name) { | |
var element = { | |
'type': 'Feature', | |
'geometry': { | |
'type': 'Point', | |
'coordinates': [Number(x), Number(y)] | |
}, | |
'properties': { | |
'name': name | |
} | |
}; | |
return element; | |
} | |
oldGeo.map(function(value, index, obj) { | |
newGeo.features.push(new feature(value.lat, value.lon, value.name)); | |
}); | |
console.log(JSON.stringify(newGeo)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment