[gdal-dev] SetFeature trouble! (HELP)
Frank Warmerdam
warmerdam at pobox.com
Thu Jun 6 15:59:29 PDT 2013
On Thu, Jun 6, 2013 at 3:34 PM, Mauro Pisano
<mauropisano at suremptec.com.ar>wrote:
>
> Hi everyone!
>
> I have a question about using the method OGRLayer::Layer().
>
> Following i show you a protion of code:
>
> /*** */
> // Create geometry from wkt
> OGRGeometryFactory::createFromWkt(&pwkt, pSpatialRef, &pgeometry);
>
> /** Configure geom
> pCurrentFeature_->SetGeometry(&pgeometry);
>
Mauro,
Assuming that pgometry is declared as "OGRGeometry *pgeometry;" I don't
see how the proposed SetGeometry call would compile. You should be passing
an OGRGeometry* to SetGeometry, not an OGRGeometry**. Also, if you aren't
going to use the geometry for anything else you might as well call
SetGeometryDirectly() which grants ownership of the geometry to the feature
so you don't have to free it.
> if (pCurrentLayer_->SetFeature(pCurrentFeature_) != OGRERR_NONE) {
> SHOW_ERROR(message_LAYER_MODIFIED_CLOSE_ERROR);
> }
>
Note that SetFeature() is used to update an existing featre in the layer.
I think you creating new features and so you should be using
CreateFeature(). With SetFeature() you are supposed to have the FID
already established so the layer knows where it belongs.
I'm not sure why you are seeing an error put still that things seem to
work.
Best regards,
Frank
>
> 1: The SetFeature, returns with an error, but if I open the .DBF file I
> found that the insert was made.
> Then... why I have the Feature set?, taking account that the method is
> returning FAIL.
>
> 2: Suppose that i have two features, and I open it and started to edit a
> third feature. Whats
> wrong in this case, is that after the insert, the value of the FID is a
> very very very big number. Example:
>
> Feature 1 = FID = 0;
> Feature 2 = FID = 1;
> Feature 3 = FID = 2893772.
>
> I dont have any clue about whats happening, any kind of data will be
> appreciated.
>
> Thanks in advance,
>
> Mauro Pisano
> SUR Emprendimientos Tecnológicos
>
> Perú 345 Piso 5to Oficina "B" (C1067AAG)
> Ciudad de Buenos Aires, Argentina
> Tel. +54 (11) 4342-2976/84
> mauropisano at suremptec.com.ar
> www.suremptec.com
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
--
---------------------------------------+--------------------------------------
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 Software Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130606/38a3c189/attachment-0001.html>
More information about the gdal-dev
mailing list