[OSM-talk] SQL

Jon Burgess jburgess777 at googlemail.com
Sun May 10 13:19:35 BST 2009


On Sun, 2009-05-10 at 06:49 +0200, Torsten Mohr wrote:
> I also tried to access "Thüringen" by its osm_id, but also no success.
> 
> In "PSQL gis":
> 
> gis=> select osm_id, name from planet_osm_polygon where name like
> 'Thüringen' 
> limit 1000;
>  osm_id |   name
> --------+-----------
>  -76689 | Thüringen
> (1 Zeile)
> 
> 
> Can anybody tell me how to draw the three missing states?
> 
> Is there an explanation why they are "missing"?
> 

Since the entry is in the polygon table, the only obvious problem I can
think of is the direction of the polygon, clockwise vs
counter-clockwise. Mapnik & Postgis really want all polygons to be
clockwise but the osm2pgsql code does not guarantee this. Try doing:

$ psql gis
gis=> update planet_osm_polygon set way=ST_Reverse(way) where osm_id=-76689;

On older versions of postgis, ST_Reverse(way) might need to
reverse(way).


> 
> Is it possible to access parts from PostGIS by their osm_id from
> osm.xml?

Filtering on osm_id should work, but it would be better to put this into
a WHERE osm_id=... clause in the datasource query.

	Jon





More information about the talk mailing list