[postgis-users] Function isvalid()

Markus Schaber schabios at logi-track.com
Mon Mar 15 05:36:36 PST 2004


Hi, Christian,

On Mon, 15 Mar 2004 13:05:21 +0100
"Christina Biakowski" <christina.biakowski at ccgis.de> wrote:

> Dear list,
> I wonder for which criteria the function isvalid() checks geometries?
> I have checked my data (MULTIPOLYGON) with isvalid() and now I am
> trying to find out where the errors result from. While for a part of
> the geometries for which isvalid() returned false the errors are quite
> obvious for me(unclosed polygons, crossing lines without
> intersections/nodes) a part of the not-valid-objects seem quite ok for
> me like the following example:
> 
> SRID=31492;MULTIPOLYGON(((2597146.2 5653827.98,2597156.824
> 5653821.184,2597160.82 5653838.11,2597164.213 5653852.142,2597173.395
> 5653866.878,2597257.03 5653936.45,2597253.37 5653989.33,2597248.112
> 5653988.184,2597244.88 5653987.48,2597248.42 5653946.81,2597245.74
> 5653940.22,2597167.25 5653872.7,2597160.76 5653864.92,2597156.23
> 5653856.5,2597154.17 5653850.63,2597146.2 5653827.98),(2597238.78
> 5654011.58,2597243.1 5654008.01,2597244.53 5653991.51,2597247.705
> 5653992.204,2597253.09 5653993.38,2597251.87 5654010.96,2597253.688
> 5654013.749,2597255.28 5654016.19,2597238.78 5654011.58)))

It seems that your Multipolygon consists of one polygon whose whole lies
outiside of the outer ring.

In case you wanted to have two polygons without holes, you have to
correct the ()s:

SRID=31492;MULTIPOLYGON(((2597146.2 5653827.98,2597156.824
5653821.184,2597160.82 5653838.11,2597164.213 5653852.142,2597173.395
5653866.878,2597257.03 5653936.45,2597253.37 5653989.33,2597248.112
5653988.184,2597244.88 5653987.48,2597248.42 5653946.81,2597245.74
5653940.22,2597167.25 5653872.7,2597160.76 5653864.92,2597156.23
5653856.5,2597154.17 5653850.63,2597146.2 5653827.98)),((2597238.78
5654011.58,2597243.1 5654008.01,2597244.53 5653991.51,2597247.705
5653992.204,2597253.09 5653993.38,2597251.87 5654010.96,2597253.688
5654013.749,2597255.28 5654016.19,2597238.78 5654011.58)))

Do you know the Java Topology Suite (JTS)? This is the java version of
GEOS, and it also contains the JTS Test Builder, a GUI tool to display
and test geometries.

HTH,
Markus
-- 
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios at logi-track.com | www.logi-track.com



More information about the postgis-users mailing list