[geos-devel] isvalid() -- segmentation fault

David Blasby dblasby at refractions.net
Thu Sep 18 18:14:28 EDT 2003


This program will cause a segfault during the isvalid() function.

-------------- next part --------------
// g++ test3.cpp -I/usr/local/include/geos -lgeos

#include "stdio.h"
#include "io.h"
#include "geom.h"

using namespace geos;

int main(int argC, char* argV[])
{

	WKTReader *r = new WKTReader();
	GeometryFactory *geomFactory;
	Geometry *g1, *g2 ;

	geomFactory= new GeometryFactory( new PrecisionModel(), -1);

	//g1 = r->read("MULTIPOLYGON(((1033707.6 1048313.1,1033694.9 1048315.7,1033659.9 1048344.3,1033627.6 1048388.8,1033620.9 1048426.8,1033623.6 1048471.3,1033623.6 1048480.8,1033616.8 1048503.2,1033629.1 1048541.3,1033668.3 1048707.6,1033696.3 1048755.6,1033721.4 1048771.6,1033724.5 1048772,1033737.2 1048772,1033772.1 1048756.4,1033794.6 1048721.9,1033811.1 1048667.4,1033814.8 1048613.6,1033815.1 1048597.5,1033809.2 1048556.1,1033809.3 1048549.6,1033797.1 1048501.9,1033790.9 1048492.2,1033773 1048399.6,1033760.6 1048377.6,1033741.8 1048357.8,1033742.1 1048341.8,1033713.9 1048313.4,1033707.6 1048313.1)))");
	g1 = r->read("POLYGON((1033707.6 1048313.1,1033694.9 1048315.7,1033659.9 1048344.3,1033627.6 1048388.8,1033620.9 1048426.8,1033623.6 1048471.3,1033623.6 1048480.8,1033616.8 1048503.2,1033629.1 1048541.3,1033668.3 1048707.6,1033696.3 1048755.6,1033721.4 1048771.6,1033724.5 1048772,1033737.2 1048772,1033772.1 1048756.4,1033794.6 1048721.9,1033811.1 1048667.4,1033814.8 1048613.6,1033815.1 1048597.5,1033809.2 1048556.1,1033809.3 1048549.6,1033797.1 1048501.9,1033790.9 1048492.2,1033773 1048399.6,1033760.6 1048377.6,1033741.8 1048357.8,1033742.1 1048341.8,1033713.9 1048313.4,1033707.6 1048313.1))");

	string s= g1->toString();
	cout << "geom1 = "<<s << endl;

	try {

	if (g1->isValid())
		cout <<" is valid" << endl;
	else
		cout << " in NOT valid "<< endl;
	}
	catch(...)
	{
		cout<<"error thrown"<<endl;
	}
}



More information about the geos-devel mailing list