[postgis-tickets] [PostGIS] #2307: ST_MakeValid outputs invalid geometries
PostGIS
trac at osgeo.org
Wed Jun 5 10:15:20 PDT 2013
#2307: ST_MakeValid outputs invalid geometries
--------------------------+-------------------------------------------------
Reporter: dmiranda | Owner: pramsey
Type: defect | Status: new
Priority: high | Milestone: PostGIS 2.0.4
Component: postgis | Version: 2.0.x
Keywords: st_makevalid |
--------------------------+-------------------------------------------------
Changes (by pramsey):
* cc: strk (added)
Comment:
OK, so some interesting results... the result of ST_MakeValid on the
geometry cited in the comment is this:
{{{
select st_astext(st_makevalid(geom)) from test;
MULTIPOLYGON(((1.38241720848787e+306
1.38241720848787e+306,1.38241720848787e+306
1.38241720848787e+306,1.38241720848787e+306
1.38241720848787e+306,1.38241720848787e+306
1.38241720848787e+306,1.38241720848787e+306
1.38241720848787e+306,1.38241720848787e+306 1.38241720848787e+306),(0
1.38241720848787e+306,1.38241720848787e+306
1.38241720848787e+306,1.38241720848787e+306
2.13091231225152e-314,6.95322297557074e-310
2.12970193392818e-314,6.95322297557153e-310 1.38241720848787e+306)))
}}}
Fun, hey? But it gets better. This is a single-part multi-polygon... what
happens if we strip out the multi and clean the polygon as a singleton.
{{{
select st_astext(st_makevalid(st_geometryn(geom,1))) from test;
POLYGON((-41.1931560828767 -7.32572934869855,-41.161610776897
-7.32573074083104,-41.1569353108121 -7.32573081181504,-41.1569356001464
-7.34833623254846,-41.193158194274 -7.34833476367411,-41.1931560828767
-7.32572934869855),(-41.161610776897 -7.32573074083104,-41.1879093408465
-7.32573084378415,-41.1879095682369 -7.34254610131274,-41.1616110087225
-7.34254610942963,-41.161610776897 -7.32573074083104))
}}}
Hey presto, it works, and this output is actually valid (though looking at
it in the JTS testbuilder, it still looks invalid until you zoom up quite
close to see that it doesn't have a hole/hull edge coincidence, just a
Very Very close hole and hull.
So, first thing is to examine what the cleaning functions are doing on
multi-geometries and see if we can just plug that easy problem to start
with.
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2307#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list