[OSM-dev] osm2pgsql / postgis precision

Etienne Chové chove at crans.org
Mon Jun 29 15:23:16 BST 2009


Hi,

I'm trying to use functions such as st_touches, st_crosses, st_overlap 
from postgis but due to incoherence in import mecanism the data are 
inconsistent :

<postgis>
gis=> SELECT id,nodes[1] as firstnode,nodes[array_upper(nodes,1)] as 
lastnode FROM planet_osm_ways WHERE id IN (35996595,35996591);
     id    | firstnode | lastnode
----------+-----------+-----------
  35996591 | 420765141 | 309351619
  35996595 | 420748383 | 309351619
</postgis>

These two ways have the same terminal node, but they are not exactly at 
the same position :

<postgis>
gis=> select osm_id, astext(st_boundary(way)) as exteremites from 
planet_osm_roads where osm_id IN (35996595,35996591);
   osm_id  |                                   exteremites
----------+----------------------------------------------------------------------------------
  35996591 | MULTIPOINT(-100527.600494421 5992007.45755514,-100209.72 
5993195.32)
  35996595 | MULTIPOINT(-92980.895991175 
5995569.89694427,-100209.727688461 5993195.32213384)
</postgis>

The right position is the second one :

<postgis>
gis=> SELECT id,lon,lat from planet_osm_nodes where id=309351619;
     id     |        lon        |       lat
-----------+-------------------+------------------
  309351619 | -100209.727688461 | 5993195.32213384
</postgis>

Do you know if there is a simplification into data import. I suppose one 
of these way have been imported during initial import and the other one 
during a diff import (but not sure). Maybe one of the two processes 
(initial/diff import) simplify data ?

Chears.

Etienne




More information about the dev mailing list