[postgis-users] sequential query

Tomas Lanczos lanczos at t-zones.sk
Sun Jan 3 16:26:08 PST 2010


Dear all,

I am not sure whether am I using correct terminology in the subject, so
I will try to explain my problem:

I am trying to write a spatial query to measure a a 3D distance between
two neighboring points. The basic query I prepared is the following:

"UPDATE particle_set_3dps set distance = (SELECT
ST_length3d(ST_MakeLine((SELECT particle_set_3dps.the_geom from
particle_set_3dps where id = 1), (SELECT particle_set_3dps.the_geom
from particle_set_3dps WHERE id = 2)))) where id = 1; "

What I need further is the distance between points with id = 2 and id =
3, between id=3 and id=4, between id=4 and id=5 etc. ...

I assume that it is not so complicated to write a query for that, but I
never needed it until now and I don't know what therms to use as
keywords to find an answer somewhere, also due to my poor English (shame
on me, I know ... ;)).

Best regards and many thanks in advance

Tomas 




More information about the postgis-users mailing list