[OSM-dev] Best way to select from a region

Stephan Knauss osm at stephans-server.de
Tue Sep 1 00:56:20 BST 2009


I'm trying to create lists of features inside a specific country.
What would be the most convenient way to do this?

As source I could either use a planet file and use a SAX parser or 
PostgreSQL with the osm2pgsql mapnik schema.

As a boundary polygon I would prefer the borders already in the database 
as these are more accurate compared to the polygon files of cloudmade.

I saw the table planet_osm_line contains the boundary relations. Could 
that be used?

planet_osm_point contains the tags already decoded into columns. But i 
would need to join this to do the restriction to the bounding-polygon, 
right? Would it be better to use planet_osm_nodes, select the tags and 
later throw away false positive matches? For example to match an amenity 
is easy using the _point table. With the _nodes table I might match a 
different key containing the same value.
Is there already an index to speed up the spatial query of should I 
better create one?

For the SAX approach I would need to build a spatial index, right? I 
never worked with geometry data types before, so I have a lot of things 
to learn. Sure an interesting topic...


More information about the dev mailing list