2

The QuickOSM plugin for QGIS can support users with the generation of new Overpass queries (for beginners on Overpass like me). It does this using the xml query language. I'd like to also be able to use this plugin with the alternative Overpass QL format. So far I've failed to do this despite having working queries on Overpass-turbo.

Can the plugin support the alternate language. Could I see a couple of queries - written for the plugin specifically - which work so I can base new queries on this?

The main reason for asking is that the answers I've been getting as I learn to use Overpass tend to be in Overpass QL.

0

2 Answers 2

2

Yes, QuickOSM can execute an OQL query.

Even if QuickOSM generates XML and the OQL is not colored, QuickOSM forwards the query to Overpass so it should work.

I tried to run the query from the other post:

[out:json][timeout:90];
rel["route"="bicycle"](51.4177274438, 0.259382751254,51.553418261,0.0539556851102);
way(r);
way._["surface"="paved"];
out geom;

I got the error :

The order must be node-way-relation. Check the print statement.

For your information, in your query, you are using:

[out:json]

OGR can't read JSON, so QuickOSM will change on-the-fly to

[out:xml]

Most of the time, it doesn't matter. But in the XML format, you should notice 3 categories : node, way and relation. Only nodes contain geographic informations. So ways relies on nodes. Relations relies on ways and nodes. In the JSON format, the way has its own geometry.

To fix your problem, you can't request only ways in your query. You need to add a recurse down statement to fetch nodes which are part of ways:

[out:json][timeout:90];
rel["route"="bicycle"](51.4177274438, 0.259382751254,51.553418261,0.0539556851102);
way(r);
way._["surface"="paved"];
(._;>;);
out geom;
10
  • I haven't managed to make any query in OQL work (from the plugin). I may well be doing something really stupid - but without having even a single working example to start from I'm stuck. If you could give me even one very simple example which does work I can then through trial and error work towards what I need. For example the queries here don't work: gis.stackexchange.com/questions/151108/… Jul 9, 2015 at 14:07
  • @Rostranimin I've updated my answer. Next time, share with us what kind of error you have. It's useful ;-)
    – etrimaille
    Jul 9, 2015 at 15:01
  • I followed your suggestion taking the QL built by the wizard for amenity=bench. In the plugin, I constantly get Successful query, but no result. which is not true because I can get data when I click on the Overpass turbo icon.
    – AndreJ
    Jul 9, 2015 at 15:16
  • @AndreJ Do you use the same extent ? Use the button Generate query in QuickOSM to fix the bbox and then copy/paste the query in overpass turbo.
    – etrimaille
    Jul 9, 2015 at 15:19
  • Yes the same extent. Switching to Overpass turbo takes the extent to the website.
    – AndreJ
    Jul 9, 2015 at 15:20
0

I tried with the Overpass Turbo Wizzard output for amenity=bench on an extent of 6.50876 to 6.56241 East and 51.3721 to 51.3915 North:

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“amenity=bench”
*/
[out:json][timeout:25];
// gather results
(
  // query part for: “amenity=bench”
  node["amenity"="bench"]({{bbox}});
  way["amenity"="bench"]({{bbox}});
  relation["amenity"="bench"]({{bbox}});
);
// print results
out body;
>;
out skel qt;

which results in

Successful query, but no result.

Running Generate query results in:

“amenity=bench”
*/
[out:json][timeout:25];
// gather results
(
  // query part for: “amenity=bench”
  node["amenity"="bench"](51.3720747317,6.50876494726,51.3915180471,6.50876494726);
  way["amenity"="bench"](51.3720747317,6.50876494726,51.3915180471,6.50876494726);
  relation["amenity"="bench"](51.3720747317,6.50876494726,51.3915180471,6.50876494726);
);
// print results
out body;
>;
out skel qt;

which the plugin does not like at all: Bad request OverpassAPI

Quick Query in the plugin with amenity=bench returns values, as well as going back to Overpass Turbo via the icon in the plugin.

So I think it is NOT working (at least not in an easy way) with the current plugin version 1.3.4.

6
  • 1
    First you get Bad request overpass API because of your first comment /* */ is not well structured. You forgot the beginning, the query works if you add /*. Secondly, even on Overpass turbo running the query I got no result : overpass-turbo.eu/s/akh So it's a problem between the extent and the bbox, not the plugin.
    – etrimaille
    Jul 9, 2015 at 16:03
  • I also find a problem with this - and don't know what mistake I'm making. So for example [out:json][timeout:25];(node["amenity"="bench"]({{bbox}}););out geom; returns nothing from within the plugin but works fine on overpass turbo.. Jul 9, 2015 at 16:10
  • The plugin seems to substitute the bbox wrongly: minE, minN and maxN are correct, but maxE is set to minE, resulting in a line bbox which has obviously no content. Manually changing that value returns correct data. Just another bug ... I added the right bbox according to the Openstreetmap importer in my answer. Maybe this issue: github.com/3liz/QgisQuickOSMPlugin/issues/38
    – AndreJ
    Jul 9, 2015 at 16:21
  • @AndreJ Sorry, I forgot that I was using the development version, not 1.3.4. So we can't compare our results. The good news, this seems to be fixed for the next release ;-) Create a ticket for every bug you've found. The next release will have a huge refactoring of the code.
    – etrimaille
    Jul 10, 2015 at 6:15
  • So sounds like some of my issues were bug related? (Only some due to my ignorance). Look forward to the new version - this is such a useful plugin - I'm very keen to get it working well for me. Jul 10, 2015 at 7:41

Your Answer

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

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