[postgis-users] RE: Newbie - get total distance travelled from query ofpoints

Joe Roberts jroberts1 at gmail.com
Mon Jun 23 12:34:10 PDT 2008


Excellent,

Thank you both, very helpful, all working!

Joe

>
>
> On Sun, Jun 22, 2008 at 10:20 PM, Paragon Corporation <lr at pcorp.us> wrote:
>
>>  Joe,
>> You need to convert to some sort of foot or meter projection that is
>> suitable for your area of interest.  your measures are in degrees.
>>
>> Then once you've figured out the SRID of that - then transform
>>
>> SELECT ST_Length(St_MakeLine(ST_Transform(point,rightsridgoeshere))))/1000
>> as distance
>> FROM (
>>       SELECT point FROM points
>>       ORDER BY timestamp
>> ) as p
>>
>>
>> Some good places to figure this out
>> 1) PostGIS Wiki
>> http://postgis.refractions.net/support/wiki/index.php?plpgsqlfunctions
>>
>> There is a function that given a point with a defined SRID (not -1) will
>> give you the SRID of the UTM zone for that point
>>
>> 2) http://spatialreference.org/
>>
>> Has a plethora of options and search to find the spatial ref that works
>> best for you.
>>
>> Hope that helps,
>> Regina
>>
>>
>>
>>  ------------------------------
>> *From:* postgis-users-bounces at postgis.refractions.net [mailto:
>> postgis-users-bounces at postgis.refractions.net] *On Behalf Of *Joe Roberts
>> *Sent:* Sunday, June 22, 2008 4:11 PM
>> *To:* postgis-users at postgis.refractions.net
>> *Subject:* [postgis-users] Newbie - get total distance travelled from
>> query ofpoints
>>
>> Hi,
>>
>> I am very new to PostGIS, and I'm stuck with what I hope is an easy
>> problem to solve.
>>
>> I have a table which contains a list of points, originating from a GPS
>> device's lat/long output. I want to get the distance travelled. I have
>> the following query, but the result (distance) looks far to low:
>>
>> SELECT ST_Length(St_MakeLine(point))/1000 as distance
>> FROM (
>>       SELECT point FROM points
>>       ORDER BY timestamp
>> ) as p
>>
>> I know the route was over 5 miles (probably about about 8.4 km), but
>> the query returns 0.000106496.
>>
>> Can anyone see what I am doing wrong? Is it my query, or could it be
>> my data?
>>
>> Many thanks
>>
>> Joe
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080623/0a3e47b2/attachment.html>


More information about the postgis-users mailing list