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?

6
  • 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
    Commented Oct 2, 2019 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
    Commented Oct 2, 2019 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
    Commented Oct 2, 2019 at 11:38
  • Damn! Thanks very much!
    – René K
    Commented Oct 2, 2019 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
    Commented Oct 6, 2019 at 8:00

1 Answer 1

2

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".

4
  • 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
    Commented Oct 3, 2019 at 12:02
  • @mmd 2nd query works in overpass-turbo but the question mentions error. Anyways i have edited the answer.
    – neogeomat
    Commented Oct 4, 2019 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
    Commented Oct 6, 2019 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
    Commented Oct 6, 2019 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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