3liz / QuickOSM

QGIS plugin to fetch OSM data with the Overpass API
GNU General Public License v2.0
180 stars 54 forks source link

Relations are somehow included in points layer #437

Closed pathmapper closed 1 year ago

pathmapper commented 1 year ago

What is the bug?

Relations are somehow included in points layer

[out:xml] [timeout:25];
 {{geocodeArea:Kreis Kleve}} -> .area_0;
(
    node["amenity"="social_facility"]["social_facility:for"="senior"](area.area_0);
    way["amenity"="social_facility"]["social_facility:for"="senior"](area.area_0);
    relation["amenity"="social_facility"]["social_facility:for"="senior"](area.area_0);
);
(._;>;);
out body;

results in

grafik

But should be 35 points:

http://overpass-turbo.eu/s/1pmG

grafik

Environment

pathmapper commented 1 year ago

A raw query for ways only

[out:xml] [timeout:25];
 {{geocodeArea:Kreis Kleve}} -> .area_0;
(
    way["amenity"="social_facility"]["social_facility:for"="senior"](area.area_0);
);
(._;>;);
out body;

gives also a point layer grafik

Gustry commented 1 year ago

It's normal that a "ways" query gives you also a point layer. These points are part of the "way" returned and they are show in a GIS layer because they have "tags".

Gustry commented 1 year ago

In your "advanced" section of the plugin, you can tick which geometries you want : image

Node, way, relation versus points, lines, ...

Gustry commented 1 year ago

About the relations, I don't think it's related to QuickOSM, because it's OGR in the background doing this kind of task : https://gdal.org/drivers/vector/osm.html Just keeping track of the data : (because OSM is updated every minute) : export.osm.txt

pathmapper commented 1 year ago

Thanks for your fast response, much appreciated - I'll check with OGR.

Some more findings:

Gustry commented 1 year ago

There are 24 ways in total according to Overpass-Turbo -> only 22 added (for the "only way query").

In Overpass turbo, it's not "GIS layers", they can display all results in leaflet with transforming the output of XML files, even complexe relations. In QGIS, GIS layers are more strict in their geometries. OGR can read only a subset of relation, such as type = boundaries, route or multipolygon. There is also a difference in clockwise or anti-clockwise polygons : https://github.com/qgis/QGIS/issues/32617 Can you identify which OSM ID are not in QGIS ?

I can switch the feature count for all layers : image

There are two features in the points layer which are not matching the query:

As explained earlier, this is expected. These nodes must have other tags if you scroll to the right. If you query explicitly only ways tagged highway=residential, you will get also a point layer if you have nodes having "important" tags such as highway=crossing or barrier=gate ... If you want only lines, then you must use the checkbox lines.

pathmapper commented 1 year ago

Thanks again, I think

It's normal that a "ways" query gives you also a point layer. These points are part of the "way" returned and they are show in a GIS layer because they have "tags".

explains it.

Additionally it was confusing to me, that Overpass-Turbo shows 2 relations and there were 2 "extra" points in QGIS.

Have a nice holiday!

pathmapper commented 1 year ago

Just for completeness:

About the relations, I don't think it's related to QuickOSM

Right, these are two OSM multipolygon buildings, each created from 2 ways.

So 26 ways + 2 relations -> 24 (multi-)polygons in QGIS.