[geos-devel] [GEOS] #752: TopologyException while comparing collections

GEOS geos-trac at osgeo.org
Sat Oct 31 02:25:40 PDT 2015


#752: TopologyException while comparing collections
------------------------+--------------------------
 Reporter:  sirsigurd   |      Owner:  geos-devel@…
     Type:  defect      |     Status:  new
 Priority:  major       |  Milestone:
Component:  Default     |    Version:  3.5.0
 Severity:  Unassigned  |   Keywords:
------------------------+--------------------------
 code to reproduce

 {{{
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>

 #include "geos_c.h"

 void
 log_and_exit(const char *fmt, ...) {
         va_list ap;

         fprintf( stdout, "ERROR: ");

         va_start (ap, fmt);
         vfprintf( stdout, fmt, ap);
         va_end(ap);
         fprintf( stdout, "\n" );
         exit(1);
 }

 void main() {
     initGEOS(NULL, log_and_exit);
     GEOSGeometry* pol1 = GEOSGeomFromWKT(
       "POLYGON ("
         "(0 0, 0 4, 4 4, 4 0, 0 0)"
       ")");
     GEOSGeometry* pol2 = GEOSGeomFromWKT(
       "POLYGON ("
         "(3 3, 3 4, 4 4, 4 3, 3 3)"
       ")");
     GEOSGeometry* polys[] = {pol1, pol2};
     GEOSGeometry* coll =
 GEOSGeom_createCollection(GEOS_GEOMETRYCOLLECTION, polys, 2);

     printf("polygon1 is valid: %d\n", GEOSisValid(pol1));
     printf("polygon2 is valid: %d\n", GEOSisValid(pol2));
     printf("collection is valid: %d\n", GEOSisValid(coll));
     printf("collection relate to itself: %d\n", GEOSEquals(coll, coll));
 }
 }}}

 output

 {{{
 polygon1 is valid: 1
 polygon2 is valid: 1
 collection is valid: 1
 ERROR: TopologyException: side location conflict at 3 4
 }}}

--
Ticket URL: <https://trac.osgeo.org/geos/ticket/752>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).


More information about the geos-devel mailing list