[postgis-users] Spatio-Temporal Function

Jorge Gustavo Rocha jgr at di.uminho.pt
Thu Mar 3 02:41:32 PST 2011


Qua, 2011-03-02 às 21:55 -0800, Nick raj escreveu:
> Hi,
> I am writing some spatio-temporal function in postgis.
> Like, ST_Enters( obj_geom, boundary_geom, time t1,time t2)
> i.e. Does vehicle enters in ABC area between time t1 to t2?
> For example, select ST_Enters ( obj_geom, (select boundary_geom from
> boundary), '25/2/2011 12:23:32','26/2/2011') from vehicledata where
> vehicleid= 'XYZ';
> Vehicledata is a table consist of more than 10,000 object location geometry
> named obj_geom.
> On query execution, it take one object geometry at every execution of
> ST_Enters and compare with boundary area. But this doesn't provide proper
> output because it is continous function of time i.e. Enters is made up of
> Disjoint -> Touches -> Inside.First, check for disjoint, if it is true at
> t1, then check for touches at t2 then check for inside at t3, provided
> t1<t2<t3.
> So, for creating this function, i require all the object's geometry before
> it go inside the function. So that it can call only once.
> My first problem is that
> create or replace function ST_Enters(????, geometry,timestamp,timestamp)
> returns boolean ............
> Which kind of data type to be used because i have to catch more than 10000
> rows?
> So, Can anyone tell me which data type can be used to catch this?

You can use the boolean function within another select statement. The
select statement will return the 10k rows for which or function is true.

> Second question is that,
> How to use this function in SQL in continuous manner??

Use a trigger. When new data about the vehicle gets in, you do

> Hope am i clear.
> Thanks in advance

I hope that's help you. Regards,


Jorge Gustavo Rocha
Departamento de Informática
Universidade do Minho
4710-057 Braga
Tel: 253604430 (Geral), 253604479 (Gabinete)
Fax: 253604471
Móvel: 910333888

More information about the postgis-users mailing list