2

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?

  • do you have an example id? you can use the api to find the locations using the overpass api wiki.openstreetmap.org/wiki/Overpass_turbo/… – Mapperz Mar 30 '16 at 15:30
  • Yes, here an example for the first element: way/369343998 I've download osm data from overpass-turbo.eu in geoJSON format and added in QGIS, now I need to visualize their position on the map in QGIS and compare it with other source. How could I do that? Thanks – Stefano Citterio Mar 30 '16 at 15:32
2

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.

  • 1
    Thank you very much for your clear explanation, I did as you said and now everything is displayed correctly :) – Stefano Citterio Mar 30 '16 at 16:54
4

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;

Edit: removed >; and >>; 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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