osmtogeojson
osmtogeojson copied to clipboard
Update readme and clarify need for parsing XML before feeding it to the script
overpass.txt: http://overpass-api.de/api/interpreter?data=
$ wget "$(echo cat overpass.txt
"[out:xml][timeout:25];area(3600052826)->.searchArea;(nwr"tourism"="alpine_hut";);out geom;")" -O ~/www/huts-and-shelters/testgeom.osm
$.get("testgeom.osm", function(data, status){ console.info("Data: " + data + "\nStatus: " + status); var test = osmtogeojson(data); console.info(test); });
osmtogeojson.js:1 Uncaught TypeError: Cannot read property 'length' of undefined
at osmtogeojson.js:1
at i (osmtogeojson.js:1)
at Object.success ((index):43) <- the line with: var test = osmtogeojson(data);
at fire (jquery-3.4.1.js:3291)
at Object.fireWith [as resolveWith] (jquery-3.4.1.js:3421)
at done (jquery-3.4.1.js:9533)
at XMLHttpRequest.
See for yourself at: http://pangose.users.openstreetmap.se/huts-and-shelters/#63.83825,12.27722,7z
I got it to work! Changed var test = osmtogeojson(data); to var test = osmtogeojson($.parseXML(data));