[Gdal-dev] Read/Write Oracle Spatial
Frank Warmerdam
warmerdam at pobox.com
Tue Oct 25 12:13:21 EDT 2005
On 10/25/05, Hallgren Johan E <jhhal at wmdata.com> wrote:
>
> Reading from works fine but when I call the SetFeature method it fails.
>
>
>
> The error-message I can see in the Output win is:
>
> ERROR 1: OGROCITableLayer::SetFeature(-1) failed because
> there is no apparent FID column on table BAGGIS_LINES.
>
> What's wrong?
>
> What I want was to read a record, change some value and then write it back.
>
> Any assistance would be great.
Johan,
As the error message mentions, OGR was unable to establish an
integer primary key column to use with this table as the FID (feature
id). This makes it very difficult to update a row in place, since
I don't know which row the feature comes from.
When there is no known fid column, feature ids are assigned
sequentially by the reader but it isn't a meaningful fid.
However, I am quite surprised to see the message reporting the
feature as having fid -1 (OGRNullFID) instead of 0.
If your table has a primary key column you could set the
OGR_FID environment/config variable with the name of the
column so that it will be used as FID. There should be a
cpl.SetConfigOption() method available you can call like this:
CPL.cpl.SetConfigOption( "OCI_FID", "ID" )
On the FID issue, could you try checking the f.GetFID()
value after reading the feature. I am quite surprised that it
is 0.
BTW, I am impressed to see the C# bindings working so
well. I hadn't gotten to trying them yet myself.
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