[gdal-dev] feature.clone() -> same featuredefn

Even Rouault even.rouault at mines-paris.org
Sat Aug 2 13:03:14 PDT 2014


Le samedi 02 août 2014 16:15:31, Martin Landa a écrit :
> Hi,
> 
> OGRFeature::Clone() duplicates feature. I found in API manual this
> sentence: the newly created feature is owned by the caller, and will
> have it's own reference to the OGRFeatureDefn.
> 
> When I try in Python:
> 
> ofeature = feature.Clone()
> print feature.GetDefnRef()
> print ofeature.GetDefnRef()
> 
> I am getting same reference to OGRFeatureDefn.
> 
> <osgeo.ogr.FeatureDefn; proxy of <Swig Object of type
> 'OGRFeatureDefnShadow *' at 0x7f86b7b84a20> >
> <osgeo.ogr.FeatureDefn; proxy of <Swig Object of type
> 'OGRFeatureDefnShadow *' at 0x7f86b7b84a20> >
> 
> ?

The documentation meant that Clone() will return a new standalone feature, but 
that will also increment the reference counter of the related OGRFeatureDefn 
(as new OGRFeature(poFeatureDefn) would do).

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list