I have a postgres/postgis table containing a series of sequential points. I want to add a new column to the table which contains the distance between each point and the first one, and so forth until all the points are processed (the first point should have a distance of 0). Can this be done with a query or do I need to use Python or equivalent to create a loop? Many thanks
Tell me more
×
Geographic Information Systems Stack Exchange is a question and answer site for
cartographers, geographers and GIS professionals. It's 100% free, no registration required.
|
migrated from stackoverflow.com Jul 22 '11 at 12:17
|
Hallo If assume that you have an id field called gid and that the first point has gid 1 then you can do something like:
That will add a column called dist and fill that column with the distance to the point with gid=1 HTH Nicklas |
|||
|
|
