[pgrouting-users] problem with length geometries

Stephen Woodbridge woodbri at swoodbridge.com
Sun Jan 17 10:43:03 EST 2010


Bryan Hempen wrote:
> hello!
> 
> i would to know how osm2pgrouting calculates the length of geometries, i 
> did not find it in the code.
> 
> the reason for that is that the column length of table ways shows a 
> different value as postgis's ST_length(length). try this:
> 
> select ST_length(the_geom), length from ways
> 
> can anyone explain that to me?

It is more than likely an issue of units and/or the projection used to 
calculate the length in. ST_length returns units based on the underlying 
data. If the data is in degrees the it will return cartesian calculation 
in units degrees, if the units are meters then meters, etc.

The projection the data is in will also impact the length calculations. 
I have no idea how OSM computes length values.

-Steve W



More information about the Pgrouting-users mailing list