0

I'm using a tool called "Wikivoyage Districitifier" to visualize OSM boundary relations. The query below is supposed to get all relations with certain admin_level values within a defined bounding box from OSM.

For Sydney it works perfectly okay (Overpass turbo):

[out:json][timeout:60];(relation[admin_level](if:(t["admin_level"] >= 5 &&t["admin_level"] <= 11))["wikidata"](-33.86400143885985,151.2000692923067,-33.85388041541516,151.21772895646075););out body;>;out skel qt;

For Auckland, the following query returns an empty result, which Wikivoyage Districitifier obviously is unable to process, as it only reports an error message: "Bounds are not valid". Overpass turbo):

[out:json][timeout:60];(relation[admin_level](if:(t["admin_level"] >= 5 &&t["admin_level"] <= 11))["wikidata"](-37.025032151631635,174.4815813201933,-36.71301768775455,175.04669057312287););out body;>;out skel qt;

Does anybody know what I do wrong?

  • I cannot reproduce the error message for your second query. For some reason, none of your queries return any result. Please double check your queries you've posted. – mmd Oct 2 '19 at 10:06
  • Thanks for looking into it, @mmd. I updated the queries. Overpass turbo doesn't return any results for the 2nd one but in my web app (Wikivoyage Districitifier) I get the error message ("Bounds are not valid") in the console. This would be overpass (without the "turbo", of course). – René K Oct 2 '19 at 11:37
  • 1
    None of the relations in the second query have a wikidata tag, hence there's no result. If you're getting some error message, always clearly state how to reproduce them. – mmd Oct 2 '19 at 11:38
  • Damn! Thanks very much! – René K Oct 2 '19 at 11:39
  • 1
    You need to go the the "Network" tab in the developer tools and inspect the Overpass response. There's no such error message like "Bounds are not valid" in there, just an empty list of elements. The errror mesage is triggered by " mymap.fitBounds(jsonLayer.getBounds());" inside the Leaflet library. – mmd Oct 6 '19 at 8:00
1

After removing the "wikidata" in the 2nd query it returns results. Previously it was returning empty results. This should be because there are no elements with wikidata tag in the second area.

The error message you were getting was only caused by the "Wikivoyage Districtifier" tool. A proper response by this tool would have been something along the lines "Your Overpass query did not return any boundary relations to display".

  • Strictly speaking, your answer is a bit misleading. The second query works correctly even with the wikidata tag filter. The empty result is correct in this case, and is a result of the OSM data being queried. The issue is with the expectation of the OP that every relation has a wikidata tag, which clearly isn't the case. – mmd Oct 3 '19 at 12:02
  • @mmd 2nd query works in overpass-turbo but the question mentions error. Anyways i have edited the answer. – neogeomat Oct 4 '19 at 10:42
  • The error message in the console (F12 in the browser) comes straight from overpass, but I guess this is irrelevant to this question. – René K Oct 6 '19 at 6:53
  • 1
    See above, the errror mesage is triggered by the line mymap.fitBounds(jsonLayer.getBounds());. Leaflet will raise an error "Bounds are not valid", because the Overpass response did not include any bounds tag. – mmd Oct 6 '19 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.