You are not logged in.

#1 2021-05-01 14:27:26

PlainMap
New Member
Registered: 2021-05-01
Posts: 1

Connecting planet_osm_polygon and planet_osm_point

I have somewhat of a newbie question:

How can I relate entries in the polygon table with entries in the points table in a reliable way?

A concrete example: getting all major german cities and their polygons. My naive approach:

This query works great for getting all 83 major cities:

SELECT name FROM planet_osm_point WHERE place = 'city'

When using the result in a polygon query though...

SELECT name
FROM planet_osm_polygon
WHERE
    boundary='administrative' AND
    name in (SELECT name FROM planet_osm_point WHERE place = 'city')
;

... the result contains many duplicates:

Berlin
Potsdam
Magdeburg
Magdeburg
Magdeburg ...

I realize, that there are different admin_level's which I would have to restrict as well.

I am looking for insights into how I can connect planet_osm_polygon and planet_osm_point more systematically.
Maybe using osm_ids or something similar.

Thank you for reading smile

Offline

Board footer

Powered by FluxBB