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

David Blasby dblasby at refractions.net
Tue Apr 8 16:12:24 EDT 2003


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;

}





More information about the geos-devel mailing list