Hi Gus,

There isn't a function to to that exactly, but you can accomplish it easy enough by doing just what you said ... appending the startpoint to the end of the linestring.
ie.
UPDATE my_lines SET geom = ST_AddPoint(geom, ST_StartPoint(geom));

SELECT isring(addpoint(geom, startpoint(geom)))
FROM (select 'LINESTRING(0 0, 0 1, 1 1, 1 0)'::geometry as geom) as foo

I suppose you could also run your lines through the snaptogrid function to remove duplicate points ... just in case you added a startpoint to an already closed ring.

Cheers,
Kevin

Gustavo Ces wrote:
Thanks Kevin,

I´ll try it later, because it seems dump gives something different i expected, so some experimentation is required. By the way, I´m trying a different approach and i´ve got a question. After searching in postgis list and manual, i can´t find a postgis function to close an open linestring. So i supose have to add the first point as the last one in my not very complex polygons. No problem. But my question is, is there any other way? I think this type of job is very usual (Arcgis, Cad software has functions to do it), so i´ts strange all postgis folks write a large sentence to solve this... Is there any Postgis function or postgis trick? Maybe this mail is linked to another ones, talking about "reinventing the wheel"? :)

Gus
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to