[postgis-users] st_length problem

Nicklas Avén nicklas.aven at jordogskog.no
Thu Mar 22 03:41:58 PDT 2012


No it is not meters.

What you can do is casting to geography type on the fly, something like:

select o.osm_id, ST_AsText(ST_Transform(o.way,4326)),
ST_Length(ST_Transform(o.way,4326)::geography)

The you will get your answer in meters.

I think that cast will work, but I havenot tried.

HTH

Nicklas




On Thu, 2012-03-22 at 11:32 +0100, Ed Linde wrote:
> Hi All,
> Am trying to measure the length of road segments from OSM (open street map) and getting some weird values. Is this in meters? If so its too small. 
> Is my query right?
> 
> 
> select o.osm_id, ST_AsText(ST_Transform(o.way,4326)), ST_Length(ST_Transform(o.way,4326))
> from planet_osm_line o
> where o.highway is not null;
> 
> 
> 26781954;"LINESTRING(12.4488377563054 55.7052298677097,12.4475093276633 55.7050849548856,12.4459445522699 55.7049392822841,12.444526741257 55.7048546522258,12.4432355926991 55.7048141593102,12.4415570905907 55.7047361597132,12.439932936557 55.7046743571964,12.4383072553874 55.7046393812816,12.4376592107414 55.704619792731)";0.0112000095550213
> 
> 26487076;"LINESTRING(12.4376603785513 55.7323555892184,12.4377151757836 55.7341099847101,12.4377174215718 55.734184081729,12.4377245182625 55.7344121883925,12.4377250572517 55.7344266536481)";0.00207207442718709
> 
> 114383319;"LINESTRING(12.4378901676009 55.7615479714339,12.4377832680821 55.7617575712814,12.4376867890206 55.7619467509818)";0.000447647154409751
> 
> 
> cheers,
> Ed
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users





More information about the postgis-users mailing list