[geos-devel] is this a bug polygon intersection?

Martin Davis mbdavis at VividSolutions.com
Wed Nov 12 12:15:41 EST 2003


The reason for this error is that the first polygon is invalid.  It has a self-intersection around POINT ( 16196.722554 44994.293317 )

It's hard to see this visually, but you can "see" it from the fact that the first and fourth points of the polygon are the same.  The polygon shell "bends back" on itself and self-intersects at this point.

The moral is: always ensure your Geometries are valid before running spatial functions.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040 - Local 308      Fax: (250) 385 6046



> -----Original Message-----
> From: jingping xie [mailto:jingping.xie at jicoux.com]
> Sent: Wednesday, November 12, 2003 3:33 AM
> To: geos-devel at geos.refractions.net
> Subject: [geos-devel] is this a bug polygon intersection?
> 
> 
> 
> the following attached a test xml that intersects two polygons.
> 
> an exception was got:
> Microsoft C++ exception: geos::TopologyException @ 0x0012e5e0。
> 
> is there a bug in polygon intersection?
> 
> xie
> 
> 2003,11,12
> 
> 
> attatched:
> 
> "test.xml"
> 
> <run>
>   <precisionModel scale="1.0" offsetx="0.0" offsety="0.0"/>
> <case>
>   <desc>AA - simple polygons</desc>
>   <a>
>     POLYGON(
>       (16196.722554 44994.293317, 16200.762720 45002.272645, 
> 16199.651674
> 45000.050554, 16196.722554 44994.293317, 16184.703060
> 44971.365375,16182.985990 44968.032238, 16176.622728 44955.406719,
> 16174.905658 44952.174586, 16167.734363 44938.135009, 16168.744404
> 44935.003881, 16214.398280 44911.570918, 16230.760953 44943.488229,
> 16232.478023 44946.821366, 16259.749144 45000.050554, 16278.434912
> 45036.715060, 16258.739102 45048.330537, 16232.983044 45063.279152,
> 16231.973003 45062.774131, 16200.762720 45002.272645, 16199.651674
> 45000.050554, 16196.722554 44994.293317))
>   </a>
>   <b>
>     POLYGON(
>       (17000.000000 46000.000000, 17000.000000 45000.000000, 
> 16000.000000
> 45000.000000, 16000.000000 45000.000000, 17000.000000 46000.000000))
>   </b>
> <test>
>   <op name="intersection" arg1="A" arg2="B">
>     POLYGON(
>       (50 50, 50 100, 100 100, 100 50, 50 50))
>   </op>
> </test>
> </case>
> </run>
> 
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel
> 



More information about the geos-devel mailing list