[postgis-users] PostGIS to calculate time spent within polygon

Suhr, Ralf Ralf.Suhr at itc-halle.de
Tue Oct 6 06:47:43 PDT 2009

Hello Masanao Yajima,


for db-design you can go with ogr2ogr (GPX -> PostGIS). Ogr2ogr creates
point and line geometrys from gpx files. In case of linestring you have
to add the 4. Dimension from the point table.

A optimal query would be the intersection from gps-linestrings and your
polygon area. The result can be many sublinestrings with start and end


Gr Ralf


Von: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] Im Auftrag von
Masanao Yajima
Gesendet: Montag, 5. Oktober 2009 23:03
An: postgis-users at postgis.refractions.net
Betreff: [postgis-users] PostGIS to calculate time spent within polygon


Dear PostGIS users

I am new to PostGIS and I would like expert opinion on how to deal with
my situation.

I have 2D GPS data and time associated with each points and they
represents line of a trip.
I also have few geographic polygon data representing some area on a map.

what I want to get out is length of time that is spent within polygon
area for a trip.

What is the optimal way to design a database and what kind of query
would you use to get such a number.

One constraint is the time interval for GPS is not accurate so sampling
rate vary alot with in a trip.

I thought of using time as 4th dimension but I believe st_intersection
is not implemented on the 4th dimension..

I could do this by bruit force but I am looking for something fast.

I appreciate your help.

Masanao Yajima

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20091006/89494799/attachment.html>

More information about the postgis-users mailing list