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

Suhr, Ralf Ralf.Suhr at itc-halle.de
Wed Oct 7 00:42:43 PDT 2009


I think the best solution a join from the inersect line and the gps-points group by min/max time. Because the intersect line havn't M-values and the first and the last point from line haven't corrospondending gps-points.

Gr Ralf

-----Ursprüngliche Nachricht-----
Von: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] Im Auftrag von Simon Greener
Gesendet: Mittwoch, 7. Oktober 2009 07:38
An: PostGIS Users Discussion
Betreff: Re: [postgis-users] PostGIS to calculate time spent within polygon

I haven't used the Linear referencing funcitons of PostGIS but perhaps this might help.

First find the intersection points of the measured line and the polygon using ST_Intersection. Don't worry about loosing the M in the returned data - what you want is the point at which the line enters (ST_StartPoint) and leaves (ST_EndPoint).

Then use these points and the appropriate Linear referencing functions (http://postgis.refractions.net/documentation/manual-1.4/ch07.html#Linear_Referencing) to compute the time measure values where the line enters the polygon and when it leaves.

regards
Simon

http://postgis.refractions.net/documentation/manual-1.4/ST_Line_Locate_Point.html
On Wed, 07 Oct 2009 14:19:37 +1100, George Silva <georger.silva at gmail.com> wrote:

> You can select the interval between minimun and maximum timestamp outside
> each polygon. Interpolate to get a value "when entering" the polygon
> (intersection between line and polygon) and when leaving.
>
> Then you can subtract both values to get an estimate of time.
>
> You probably can write a simple function for this.
>
> George
>
> On Tue, Oct 6, 2009 at 11:18 PM, Masanao Yajima <yajiyajijp at yahoo.co.jp>wrote:
>
>> Thank you for your response.
>>
>> However, would it be possible to elaborate on the 2nd part?
>> If my reading of the manual is correct,
>> I believe st_intersection is not implemented to handle the 4th dimension.
>>
>> Masanao Yajima
>>
>> On Tue, Oct 6, 2009 at 6:47 AM, Suhr, Ralf <Ralf.Suhr at itc-halle.de> wrote:
>>
>>>  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 time.
>>>
>>>
>>>
>>> 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
>>>
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>>
>>
>>
>> --
>> Masanao Yajima
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>
>


-- 
SpatialDB Advice and Design, Solutions Architecture and Programming,
Oracle Database 10g Administrator Certified Associate; Oracle Database 10g SQL Certified Professional
Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE, Manifold GIS, FME, Radius Topology and Studio Specialist.
39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia.
Website: www.spatialdbadvisor.com
   Email: simon at spatialdbadvisor.com
   Voice: +61 362 396397
Mobile: +61 418 396391
Skype: sggreener
Longitude: 147.20515 (147° 12' 18" E)
Latitude: -43.01530 (43° 00' 55" S)
GeoHash: r22em9r98wg
NAC:W80CK 7SWP3
_______________________________________________
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