[postgis-users] Newbie - get total distance travelled from query ofpoints
Paragon Corporation
lr at pcorp.us
Sun Jun 22 14:20:36 PDT 2008
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080622/40e7a65a/attachment.html>
More information about the postgis-users
mailing list