Overpass API developpement

Text archives Help


Re: [overpass] Odd results when switching from Overpass QL to XML


Chronological Thread 
  • From: Pierre Béland <pierzenh@yahoo.fr>
  • To: "overpass@listes.openstreetmap.fr" <overpass@listes.openstreetmap.fr>, "overpass@osm101.openstreetmap.fr" <overpass@osm101.openstreetmap.fr>
  • Subject: Re: [overpass] Odd results when switching from Overpass QL to XML
  • Date: Mon, 22 Feb 2016 01:56:25 +0000 (UTC)

I suggest that you avoid mixing parent and child queries.

In the query below, the union is to extract only the parent objects and output them before querying the childs.

From Overpass-turbo, Using the Query export function to translate in xml, I obtained the same result.

this give 431 nodes, 54 ways and 7 relations.


[out:json];
(
way["building"](52.516710528069794, 13.406785726547241, 52.51946886742985, 13.41103971004486
);
way["building:part"](52.516710528069794, 13.406785726547241, 52.51946886742985, 13.41103971004486
);
relation["building"](52.516710528069794, 13.406785726547241, 52.51946886742985, 13.41103971004486
);
relation["building:part"](52.516710528069794, 13.406785726547241, 52.51946886742985, 13.41103971004486
);
relation["type"="building"](52.516710528069794, 13.406785726547241, 52.51946886742985, 13.41103971004486
);
);
out;
>;
out;
 
 
Pierre



De : Jan Marsch <mail@osmbuildings.org>
À : overpass@osm101.openstreetmap.fr
Envoyé le : Dimanche 21 février 2016 19h16
Objet : [overpass] Odd results when switching from Overpass QL to XML

Hello,

TL;DR: When converting Overpass QL to XML Query, results get messed up.

Formerly with direct access to public Overpass, I’ve used this query to get all buildings & parts:

[out:json];
(
way["building"]({s},{w},{n},{e});
node(w);
way["building:part"]({s},{w},{n},{e});
node(w);
relation["building"]({s},{w},{n},{e});
way(r);
node(w);
relation["building:part"]({s},{w},{n},{e});
way(r);
node(w);
relation["type"="building"]({s},{w},{n},{e});
way(r);
node(w);
);out;

Now I’m running a local Overpass instance which gets accessed by a custom web server.
In order to use osm3s_query, I needed to convert the query to XML with http://overpass-turbo.eu/
Result is this:

<osm-script output="json">
  <union into="_">
    <query into="_" type="way">
      <has-kv k="building" modv="" v=""/>
      <bbox-query e="13.41103971004486" into="_" n="52.51946886742985" s="52.516710528069794" w="13.406785726547241"/>
    </query>
    <recurse from="_" into="_" type="way-node"/>
    <query into="_" type="way">
      <has-kv k="building:part" modv="" v=""/>
      <bbox-query e="13.41103971004486" into="_" n="52.51946886742985" s="52.516710528069794" w="13.406785726547241"/>
    </query>
    <recurse from="_" into="_" type="way-node"/>
    <query into="_" type="relation">
      <has-kv k="building" modv="" v=""/>
      <bbox-query e="13.41103971004486" into="_" n="52.51946886742985" s="52.516710528069794" w="13.406785726547241"/>
    </query>
    <recurse from="_" into="_" type="relation-way"/>
    <recurse from="_" into="_" type="way-node"/>
    <query into="_" type="relation">
      <has-kv k="building:part" modv="" v=""/>
      <bbox-query e="13.41103971004486" into="_" n="52.51946886742985" s="52.516710528069794" w="13.406785726547241"/>
    </query>
    <recurse from="_" into="_" type="relation-way"/>
    <recurse from="_" into="_" type="way-node"/>
    <query into="_" type="relation">
      <has-kv k="type" modv="" v="building"/>
      <bbox-query e="13.41103971004486" into="_" n="52.51946886742985" s="52.516710528069794" w="13.406785726547241"/>
    </query>
    <recurse from="_" into="_" type="relation-way"/>
    <recurse from="_" into="_" type="way-node"/>
  </union>
  <print e="" from="_" geometry="skeleton" limit="" mode="body" n="" order="id" s="" w=""/>
</osm-script>

When executing this now, it misses a lot of building parts and ssemingly properties as well.

I’m very unsure, whether the syntax is correct and whether union and recursions work properly.

1. Can I probably use the Overpass QL withiut havin Apache in place?
2. Could you review my XML query, regarding the intended query above?

Thank you very much
Jan




Archive powered by MHonArc 2.6.18.

Top of page