[gdal-dev] Re: Import ESRI shpaefile (line) into exsiting
Oracle Spatial schema
Jukka Rahkonen
jukka.rahkonen at mmmtike.fi
Tue Dec 8 09:56:47 EST 2009
Dejan Gregor <dejan.gregor <at> GMAIL.COM> writes:
> Hi,
>
> I was searching fro a good sample how I can import a file called
> 'LINE5001.shp' (linear feature class) into a predefined schema of an SDO
> layer in 'USER1' schema into the 'LINE1' table? TNS name is 'ORCL'.
>
> Geometry field is called 'GEOM' and the SRID for the SDO layer is set to the
> value '5000000'. The schema owner 'USER1' has a password 'pwd'.
>
> What would be syntax for the import of the line objects into Oracle through
> OCI and OGR2OGR?
In principle it should go this way:
ogr2ogr -update -append -f "OCI" OCI:USER1/pwd at ORCL:LINE1 line50001.shp
However, it will fail and give you a SRID missmatch error. I have a feeling that
OCI driver cannot append data to Oracle at all if the table is using SRID.
There is an OCI specific parameter that works when creating a new table (-lco
SRID=5000000), but because it is a layer creation option it does not work when
appending data to an existing table. A work around would be to
- drop the spatial index of your table
- update all the geometries in the table into so that they have SRID=null
SQL> update LINE1 L set L.geom.sdo_srid=null;
- append your data now with the ogr2ogr command above
- update SRID of the geometries to the correct one
- create the spatial index again
I have not tested this procedure with real data but I thing it should work.
Better approach is that somebody checks if appending data with SRID through OCI
driver is really impossible, files a ticket and the bug will be corrected.
-Jukka Rahkonen-
More information about the gdal-dev
mailing list