Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a list of Points in a PostGIS table. The rows can be grouped by a date

something like:

myTable
 id INT
 date DATE
 lat NUMBER
 lng NUMBER
 geom GEOMETRY(POINT)

now I need a table where all points of one day are collected in a new geometry (sorted by id)

targetTable
 id2 INT
 date DATE
 geom2 GEOMETRY(POLYGON)

how can I do this with PostGIS or GeoKettle, I cannot use any other client since this transformation has to be done in batch?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

use ST_MakeLine function in postgis. info here...

ST_MakeLine — Creates a Linestring from point or line geometries.

Example:

SELECT gps.gps_track, ST_MakeLine(gps.the_geom) As newgeom
    FROM gps_points As gps
    GROUP BY gps.gps_track;

i hope it helps you...

share|improve this answer
    
yes, ST_MakeLine works with the aggregated POINTs , thank You –  dodiddone Jun 6 '12 at 17:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.