[postgis-users] Fixing invalid polygons created from polygonizing rasters
William Temperley
willtemperley at gmail.com
Wed Jan 14 10:25:59 PST 2009
Hi all,
We have some polygonized rasters that create invalid GEOS geometries.
Take polygon A I've attempted to illustrate below. It is one ring,
which touches itself at a single point. In line with the OGC spec it
is invalid. If it becomes two polygons, it is valid (See B I've
illustrated below).
It would be great if anyone knew of an algorithm to make A into B.
Thanks
Will
==============
A
____
| __|___
| |__| |
|_______|
MAP=# select isvalid(geomfromtext('MULTIPOLYGON(((0 0, 0 3, 2 3, 2 2,
1 2, 1 1, 2 1, 2 2, 3 2, 3 0, 0 0)))')
);
NOTICE: Ring Self-intersection
isvalid
---------
f
===============
B
____
| 1__|___
|__|__| |
|______2|
MAP=# select isvalid(geomfromtext('MULTIPOLYGON(((0 0, 0 1, 2 1, 2 2,
3 2, 3 0, 0 0)),((0 1, 0 3, 2 3, 2 2, 1 2, 0 1)))')
);
isvalid
---------
t
(1 row)
More information about the postgis-users
mailing list