I've downloaded some data from OSM about tourism buildings and now I need to compare them with data from another source, to check if the same elements are positioned in the same place or at least within a buffer of 10 metres around them. The other source has the coordinates of the point so it's easy, but data downloaded from osm don't have them (and also they are represented as polygons and not as points). However, in the attribute table, there's a field called "@id" which contains something like way/number. Is there a way to get point coordinates from this value in order to see corresponding points on the map and compare with the position with the other source?
If you're happy with a center point (instead of a centroid), you might as well use
out center; and skip the QGIS part altogether. Overpass API also supports CSV output, which you can download to Excel, etc.
Here's an example link for overpass turbo: http://overpass-turbo.eu/s/fqx
[out:csv(::"type", ::"id", ::"lat", ::"lon", name)]; area["name"="Nordrhein-Westfalen"]->.boundaryarea; ( node(area.boundaryarea)[amenity=bank]; way(area.boundaryarea)[amenity=bank]; relation(area.boundaryarea)[amenity=bank]; ); out center;
>>; in the example link, as we want to determine the center point of the way & relation only. Doing that recurse down step would also calculate the center point for each way's nodes, rather than just returning a single row for a way.
If you use Overpass turbo, you have to download the points that belong to a way as well to get the coordinates. Here is a working example of mine:
area["name"="Nordrhein-Westfalen"]->.boundaryarea; ( node(area.boundaryarea)[amenity=bank]; way(area.boundaryarea)[amenity=bank];>; relation(area.boundaryarea)[amenity=bank];>>; ); out meta;
It is the tiny
> that downloads the child elements (nodes for ways and ways for relations) as well, with their coordinates. You can use the QuickOSM plugin to get the API result directly into QGIS.
In a second step, you have to calculate the polygon centroids to get a single point for every POI.
Vector -> Geometry Tools -> Polygon Centroids ... will do that for you.
I usually copy them into the points layer, because it is up to the people that collect the data whether they use a point or a polygon. So you have to look into both layers.