[gdal-dev] Why does OCI driver fail with SRID?

Smith, Michael ERDC-CRREL-NH michael.smith at usace.army.mil
Mon Nov 30 07:37:55 EST 2009


Jukka,

To set the SRID when loading to Oracle, you have to use the layer creation
option

-lco srid=2393

Mike


-- 
Michael Smith
RSGIS Center
US Army Corps of Engineers




On 11/30/09 7:25 AM, "Jukka Rahkonen" <jukka.rahkonen at mmmtike.fi> wrote:

> Hi,
> 
> Short question: I cannot get ogr2ogr to co-operate with me and Oracle
> Spatial if I want to set the table SRID by using its EPSG code.  I can do what
> I
> want by using SQL*Plus but not with ogr2ogr. What am I doing wrong?
> 
> Longish description follows.
> 
> I was trying to use ogr2ogr that comes with MS4W 3.0 (dgal version 1.7.0dev)
> for
> 
> a) Importing a shapefile into Oracle 10g and give SRID at the same time.
> b) Appending date into existing table with SRID set.
> 
> The SRID I would like to use is epsg:2393.  It is configured it in Oracle as
> can
> be seen from the following SQL query:
> 
> select * from mdsys.cs_srs where srid=2393;
> CS_NAME | SRID |AUTH_SRID |AUTH_NAME |WKTEXT |CS_BOUNDS
> 
> KKJ / Finland Uniform Coordinate System
>       2393       2393
> www.nls.fi/maa/papers/kkj.html
> PROJCS["KKJ / Finland Uniform Coordinate System",
> GEOGCS [ "KKJ", DATUM ["Kartasto Koordinaati Jarjestelma 1966
> (EPSG ID 6123)", SPHEROID ["International 1924 (EPSG ID 7022)",
> 6378388.0, 297.0], -90.7, -106.1, -119.2, 4.09, 0.218, -1.05,
> 1.37], PRIMEM [ "Greenwich", 0.000000 ], UNIT ["Decimal Degree",
> 0.01745329251994328]], PROJECTION ["Finland Uniform Coordinate
> System (EPSG OP 18193)"], PARAMETER ["Latitude_Of_Origin", 0.0],
>  PARAMETER ["Central_Meridian", 27.0], PARAMETER
> ["Scale_Factor", 1.0], PARAMETER ["False_Easting", 3500000.0],
>  PARAMETER ["False_Northing", 0.0], UNIT ["Meter", 1.0]]
> 
> Case a) Importing data to new table with ogr2ogr
> ================================================
> Command:
> ogr2ogr -f "OCI" OCI:username/passwd at db:test -a_srs epsg:2393 test.shp
> 
> Result: Table is created and features are inserted, but without SRID set.
> Ogr2ogr is trying to insert a new line into the table MDSYS.CS_SRS but it
> fails
> because of insufficient privileges
> ERROR 1: ORA-01031: insufficient privileges
>  in INSERT INTO MDSYS.CS_SRS (SRID, WKTEXT, CS_NAME)
>  VALUES (1000003006,'PROJCS["KKJ / Finland Uniform Coordinate
> System",GEOGCS["KKJ",DATUM["Kartastokoordinaattijarjestelma_1966",
> SPHEROID["International 1924",6378388,297]],PRIMEM["Greenwich",0],
> UNIT["Decimal Degree",0.0174532925199433]],UNIT["metre",1],
> PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],
> PARAMETER["central_meridian",27],PARAMETER["scale_factor",1],
> PARAMETER["false_easting",3500000],PARAMETER["false_northing",0]]',
>  'KKJ / Finland Uniform Coordinate System' )
> 
> I wonder why org2ogr is trying to add the projection, because SRID 2393 is
> already defined in the database, and why it would like to insert my SRID=2393
> with code "1000003006".
> 
> Case b) Appending data into table having SRID=2393
> ================================================
> Command:
> ogr2ogr -update -append -f "OCI" OCI:username/passwd at db:test
>  -a_srs epsg:2393 test2.shp
> 
> This fails with Oracle error ""Layer SRID does not match geometry SRID". I can
> make the insert to succeed by dropping the spatial index of the table, but
> then
> the newly inserted features have SRID=null.
> 
> -Jukka Rahkonen
> 
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



More information about the gdal-dev mailing list