[gdal-dev] segfault on importFromWkt
Frank Warmerdam
warmerdam at pobox.com
Fri Jan 21 13:11:24 EST 2011
On 11-01-21 12:47 PM, Mohammed Rashad wrote:
> OGRGeometry *OLGeometry;
> char *geom = "POINT(6 10)";
>
> OLGeometry->importFromWkt(&geom);
> }
Rashad,
The problem is that OLGeometry is an unitialized pointer as opposed to
being a valid geometry object on which a method could be invoked.
I would suggest changing this to:
OGRGeometry *OLGeometry = NULL;
char *geom = "POINT(6 10)";
OGRGeometryFactory::createFromWkt( &geom, NULL, &OLGeometry );
Note that the documentation on OGRGeometry::importFromWkt() says:
* The object must have already been instantiated as the correct derived
* type of geometry object to match the text type. This method is used
* by the OGRGeometryFactory class, but not normally called by application
* code.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list