[postgis-users] st_length problem
Ed Linde
edolinde at gmail.com
Thu Mar 22 03:45:34 PDT 2012
Cool thanks guys! Yep the cast works and I agree looks more elegant! :)
On Thu, Mar 22, 2012 at 11:44 AM, Denis Rouzaud <denis.rouzaud at gmail.com>wrote:
> What you wrote did also a cast to geography. You should take Nicklas'
> advise as it is much more easy to read, and probably more efficient.
>
> Denis
>
>
>
> On 03/22/2012 11:42 AM, Ed Linde wrote:
>
> I think I fixed it using the following: Maybe someone can confirm its ok?
>
> select o.osm_id,
> ST_AsText(ST_Transform(o.way,4326)),
> ST_Length( ST_GeographyFromText( ST_AsText(ST_Transform(o.way,4326))))
> from planet_osm_line o
> where o.highway is not null;
>
>
>
> On Thu, Mar 22, 2012 at 11:35 AM, Ed Linde <edolinde at gmail.com> wrote:
>
>> I have a feeling that these could be lat/long degrees differences... but
>> is there a way to get the length of the road segments in meters please?
>>
>>
>> On Thu, Mar 22, 2012 at 11:32 AM, Ed Linde <edolinde at gmail.com> 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 listpostgis-users at postgis.refractions.nethttp://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120322/f3ff11c1/attachment.html>
More information about the postgis-users
mailing list