Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme and clarify need for parsing XML before feeding it to the script #115

Open
pangoSE opened this issue Feb 3, 2020 · 1 comment

Comments

@pangoSE
Copy link

pangoSE commented Feb 3, 2020

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

<script src="osmtogeojson.js"></script>

$.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. (jquery-3.4.1.js:9785)

See for yourself at: http://pangose.users.openstreetmap.se/huts-and-shelters/#63.83825,12.27722,7z

@pangoSE
Copy link
Author

pangoSE commented Feb 3, 2020

I got it to work!
Changed
var test = osmtogeojson(data);
to
var test = osmtogeojson($.parseXML(data));

@pangoSE pangoSE closed this as completed Feb 3, 2020
@pangoSE pangoSE reopened this Feb 3, 2020
@pangoSE pangoSE changed the title Can't get it to work Update readme and clarify need for parsing XML before feeding it to the script Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant