[geos-devel] BUG

David Blasby dblasby at refractions.net
Tue Nov 12 14:38:12 EST 2002


This works:

char * f()
{
   WKTReader *r = new WKTReader(GeometryFactory(PrecisionModel(),10));
   Geometry *g;
   string s,ss;
   char *cc;


    s = "POINT(0 0)";

    g =r->read(s);
    ss= g->toString();
    cc= (char *)  ss.c_str();
    return cc;

}

But this doesnt :

char *f()
{
 Coordinate *c = new Coordinate(0,0,0);
 Geometry result;
 string s,ss;
 geomFactory = new GeometryFactory();

 result =  geomFactory->createPoint(*c);  // this works

 s = result.toString();  // crashes here
}

Here's a test program:


#include <stdio.h>

#include <string>
#include <iostream>
#include <fstream>
#include "util.h"
#include "graph.h"
#include "io.h"
#include "opRelate.h"


int main(int argc, char** argv)
{
   Coordinate *c = new Coordinate(0,0,0);
   Geometry result;
   string s,ss;
   GeometryFactory   * geomFactory = new GeometryFactory();

     cout << "make point\n";
     result =  geomFactory->createPoint(*c);  // this works

     cout << "to string\n";
     s = result.toString();  // crashes here

     cout << "done\n";
}

It appears to die in the WKTWriter ...

dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geos-devel/attachments/20021112/732185a6/attachment.html


More information about the geos-devel mailing list