[postgis-users] points must form a closed linestring

Stefan Zweig stefanzweig1881 at web.de
Fri Aug 17 03:45:50 PDT 2007

hi list,

pardon me if i am bothering anybody again with a big (500k) mail
but i have the following problem:

this query fails:

SELECT t.id,t.name,asText(intersection(st_polyfromtext('Polygon((11.7 49.6, 16.0 49.6, 16.0 51.3, 11.7 51.3, 11.7 49.6))',4326),t.the_geom))
FROM _g2965 AS t  
WHERE t.the_geom && SetSRID(MakeBox2D(SetSRID(MakePoint(11.7, 49.6),4326),SetSRID(MakePoint(16.0, 51.3),4326)),4326)

with this message from postgis

NOTICE:  IllegalArgumentException: points must form a closed linestring
ERROR: POSTGIS2GEOS conversion failed

so obviously the geometry which i want to intersect with the Polygon is not a closed linestring. or better: at least one part of that geometry is a not closed linestring. if look into the geometry (a multipolygon) i recognize, that on some polygons of this multipolygon only the last point is missing. so actually i would only have to insert to first point again after the last point and the query (especially the intersectionpart) should be alright.

arnaud gave me already a good advice how to close a linestring on polygon: http://www.postgis.org/pipermail/postgis-users/2007-August/016624.html

but that is not a sufficient solution in case of a multipolygon. so how could one close all polygons being part of a multipolygon? or how could one get around the intersection error on a other way? (i know that there would be the possiblity of using isValid(), but actually this geometry is the border of russia and i want to display certain parts of it in a map. so i actually do not want to leave it off, only because the intersection failed)

kind regards,

Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 3 Monate
kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: russia.txt
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070817/93f2fb9b/attachment.txt>

More information about the postgis-users mailing list