[Gdal-dev] Read/Write Oracle Spatial

Hallgren Johan E jhhal at wmdata.com
Tue Oct 25 10:21:20 EDT 2005


Hello 

 

I have tried to read from OracleSpatial (ver 10.2.0), change some value
and then do an update with the following lines of code (C#). 

 

OGR.Driver d = OGR.ogr.GetDriverByName("OCI");

OGR.DataSource ds = d.Open(@"OCI:wmgis/wmgis01 at WMSI1394", 1);

OGR.Layer l = ds.GetLayerByName("baggis_lines");

OGR.Feature f = l.GetFeature(0);

OGR.Geometry g = f.GetGeometryRef();

g = g.Clone();

double x = g.GetX(0);

double y = g.GetY(0);

double z = g.GetZ(0);

x += 1.0;

y += 1.0;

textBox1.Text += "x="+ x + " y=" + y + System.Environment.NewLine;

l.StartTransaction();

g.SetPoint(0, x, y, z);

f.SetGeometryDirectly(g);

f.SetField("TEXT", "OLLE");

l.SetFeature(f);

l.CommitTransaction();

textBox1.Text += "count=" + l.GetFeatureCount(1) +
System.Environment.NewLine;;

 

 

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.

 

Regards

Johan

__________________________________


Johan Hallgren
WM-data


Pelle Bergs backe 3
Box 1938, 791 19 Falun
Tel: 023-844 65 (int: +46-2384465)
Mobil: 070-588 44 28 (int: +46-705884428)
johan.e.hallgren at wmdata.com <mailto:johan.e.hallgren at wmdata.com> 
http://www.wmdata.se <http://www.wmdata.se> 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20051025/9297d4c5/attachment.html


More information about the Gdal-dev mailing list