mvexel / overpass-api-python-wrapper

Python bindings for the OpenStreetMap Overpass API
Apache License 2.0
360 stars 89 forks source link

unable to use querries with alternatives #83

Closed matkoniecz closed 6 years ago

matkoniecz commented 6 years ago

I expected that

import overpass
api = overpass.API()
query="node(31134192);node(31134242);"
print(api.Get(query, responseformat="xml"))

will return both http://www.openstreetmap.org/node/31134192 and http://www.openstreetmap.org/node/31134242

but only second node was returned

<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API">
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>
<meta osm_base="2017-09-25T09:14:02Z"/>

  <node id="31134242" lat="53.6688600" lon="17.4807500">
    <tag k="addr:postcode" v="77-300"/>
    <tag k="is_in:county" v="powiat człuchowski"/>
    <tag k="is_in:municipality" v="gmina Człuchów"/>
    <tag k="is_in:province" v="województwo pomorskie"/>
    <tag k="name" v="Brzeźno"/>
    <tag k="place" v="village"/>
    <tag k="population" v="258"/>
    <tag k="source:population" v="wikipedia"/>
    <tag k="teryt:rm" v="01"/>
    <tag k="teryt:simc" v="0742730"/>
    <tag k="teryt:stan_na" v="2009-01-01"/>
    <tag k="teryt:updated_by" v="teryt2osm combine.py v. 43"/>
    <tag k="wikipedia:en" v="Brzeźno, Człuchów County"/>
  </node>

</osm>
tbolender commented 6 years ago

There is a mistake in your request. You have to use the union operator to receive both nodes:

(
  node(31134192);
  node(31134242);
);

Please refer to the official Overpass API Language guide to learn how to understand how requests are processed.