[geos-devel] BUG: relate(g1,g2) crashes with GEOMETRYCOLLECTION?

Martin Davis mbdavis at VividSolutions.com
Tue Apr 8 16:28:13 EDT 2003


Yep.  Neither GEOS nor JTS support GeometryCollections as arguments to relate.  This is partly because the semantics aren't very well defined, and partly because the obvious semantics [ X.relate(GC) = X.relate(union(GC.components) ] would make the operation non-robust.

That said, we or you could always implement the above semantics fairly easily...

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.
Suite #1A-2328 Government Street   Victoria, B.C.   V8T 5G5
Phone: (250) 385 6040    Fax: (250) 385 6046
EMail: mbdavis at vividsolutions.com  Web: www.vividsolutions.com


> -----Original Message-----
> From: David Blasby [mailto:dblasby at refractions.net]
> Sent: Tuesday, April 08, 2003 1:12 PM
> To: GEOS Development List
> Subject: [geos-devel] BUG: relate(g1,g2) crashes with
> GEOMETRYCOLLECTION?
> 
> 
> This fails in the relate() method.  I imagine that its because of the 
> GEOMETRYCOLLECTION.
> 
> 
> // g++ test2.cpp -I/usr/local/include/geos -lgeos
> 
> #include "stdio.h"
> #include "io.h"
> 
> 
> int main(int argC, char* argV[])
> {
> 
>     WKTReader *r = new WKTReader();
>     GeometryFactory *geomFactory;
>     Geometry *g1, *g2 ;
> 
>     geomFactory= new GeometryFactory( new PrecisionModel(), -1);
> 
>     g1 = r->read("GEOMETRYCOLLECTION (POINT (1.0000000000000000 
> 2.0000000000000000), POINT (3.0000000000000000 4.0000000000000000), 
> LINESTRING (5.0000000000000000 6.0000000000000000, 8.0000000000000000 
> 9.0000000000000000))");
>     g2 = r->read("POINT(0 0)");
> 
>     string s= g1->toString();
>     cout << "geom1 = "<<s << endl;
> 
>     s= g2->toString();
>     cout << "geom1 = "<<s<< endl;
> 
>     IntersectionMatrix *im = g1->relate(g2);
> 
> 
>     s= im->toString();
>     cout << "relate(g1,g2) = "<<s<< endl;
> 
> }
> 
> 
> 
> _______________________________________________
> 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