[geos-devel] problems with C/C++- getting warmer! (Reader Frees
toomuch?)
Norman Vine
nhv at cape.com
Mon Apr 7 17:29:18 EDT 2003
Dave
does this work for you ?
Norman
=== cut ===
#include <string>
#include <iostream>
#include "io.h"
#include "geos_api.h"
char *GEOSasText(GeometryWrapper g)
{
string s = WKTWriter().write((Geometry *)g);
char *result = (char *)s.c_str();
return result ;
}
GeometryWrapper createGEOSFromText(char *wkt)
{
cout <<"geom text (to be parsed):"<< wkt << endl;
Geometry *g = new Geometry;
WKTReader r = WKTReader(new GeometryFactory(new PrecisionModel(),-1));
g = r.read(wkt);
cout << endl << "geom (WKTWriter):"<< WKTWriter().write(g) << endl;
return (GeometryWrapper)g;
}
More information about the geos-devel
mailing list