[gdal-dev] segfault on importFromWkt
Mohammed Rashad
mohammedrashadkm at gmail.com
Fri Jan 21 12:47:54 EST 2011
#include "ogrsf_frmts.h"
#include <stdio.h>
int main()
{
const char *pszDriverName = "ESRI Shapefile";
OGRSFDriver *poDriver;
OGRRegisterAll();
OGRDataSource *poDS;
poDS = OGRSFDriverRegistrar::Open( "point_out.shp", FALSE );
if( poDS == NULL )
{
cout << "Open failed." << endl;
}
OGRLayer *poLayer;
poLayer = poDS->GetLayerByName( "point_out" );
OGRFeature *poFeature;
poLayer->ResetReading();
OGRGeometry *OLGeometry;
char *geom = "POINT(6 10)";
OLGeometry->importFromWkt(&geom);
}
if the line OLGeometry->importFromWkt(&geom); is not included it works
without segfault
here is the code which creates the shapefile
const char *pszDriverName = "ESRI Shapefile";
OGRSFDriver *poDriver;
OGRRegisterAll();
poDriver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(
pszDriverName );
OGRDataSource *poDS;
poDS = poDriver->CreateDataSource( "point_out.shp", NULL );
OGRLayer *poLayer;
poLayer = poDS->CreateLayer( "point_out", NULL, wkbPoint, NULL );
OGRDataSource::DestroyDataSource( poDS );
--
Rashad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110121/34081176/attachment.html
More information about the gdal-dev
mailing list