[Gdal-dev] segfault in SHPCreateObject
Frank Warmerdam
fwarmerdam at gmail.com
Mon Sep 12 11:11:04 EDT 2005
On 9/12/05, Ari Jolma <ari.jolma at tkk.fi> wrote:
> Any ideas why this segfaults:
>
> my $fd = new ogr::FeatureDefn;
> my $f = new ogr::Feature($fd);
> my $g = new ogr::Geometry($ogr::wkbPolygon);
> my $r = new ogr::Geometry($ogr::wkbLinearRing);
> do this many times: $r->AddPoint($lon,$lat);
> $g->AddGeometry($r);
> $g->CloseRings;
> $f->SetGeometry($g);
> $layer->CreateFeature($f);
>
> layer should be ok, I probably need something more into those new's?
Ari,
When creating a feature you intend to write out to a layer with
CreateFeature(), you should use the featuredefn from that layer
for the feature. It should be very rare that you need to create
your own freestanding OGRFeatureDefn objects.
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