I'm newbie to PostGIS and am looking for some SQL examples for better understanding.
I didn't understand how do I manipulate the tables, how objects relate one to another. An example:
There is this page: https://www.openstreetmap.org/relation/297514 - a city and its boundaries in strong orange.
I'm trying to do the same on my OSM server.
I found the city (the Relation ID) with the next query, because the cities I am interested have a known code/id list called IBGE:GEOCODIGO :
SELECT id,tags FROM planet_osm_rels WHERE 'IBGE:GEOCODIGO' = ANY(tags) AND '4106902' = ANY(tags) ;
Now, correct me if I'm wrong, I think there is some way to SELECT the polygon that represents the ways(?) around the city, I mean its boundaries, to finally draw this polygon with LeafLet on my OSM server.
Some code examples or a documents to understand how planet_osm data is organized and where are the "foreing_keys" to the objects I want:
- SELECT polygon (administrative boundaries) FROM city
- SELECT djikstra/ways between two points (not a line, but a road path)
this sort of thing
It seems easy to learn how to manipulate geographical objects (I found examples on PostgreSQL), but how to do it with planet_osm ?