Monday, 24 August 2015

Get a JSON return from a Overpass API call


From this call:


https://www.overpass-api.de/api/xapi?node[highway=speed_camera][bbox=-5.708215989569187,43.46669501043081,-5.605835010430813,43.588927989569186]


I'm trying to get a JSON return. Reading the API, I don't know where to put the [out:json]:



https://www.overpass-api.de/api/xapi?node[out:json][highway=speed_camera][bbox=-5.708215989569187,43.46669501043081,-5.605835010430813,43.588927989569186]



Answer



You can't get a JSON result from the XAPI-compatibility endpoint. Instead, use the standard Overpass API (“interpreter”) endpoint and put the [out:json]; at the very start of your ql query:


https://www.overpass-api.de/api/interpreter?data=[out:json];node[highway=speed_camera](43.46669501043081,-5.708215989569187,43.588927989569186,-5.605835010430813);out%20meta;

(note the different ordering of the bbox coordinates compared to the xapi request!)


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...