0

We're holding geodata in an Orcale database (11g) with spatial extension. I want to unload specific polygons and convert them into Shape for further local processing.

The table where I'm unloading from holds polygons/multipolygons: Oracle Spatial GeomTypes are 4003 and 4007 (4D-Polygon and 4D-Multipolygon - third and fourth axis are not used however).

For unloading and conversion I use this command within a python-script:

ogr2ogr.main(["", "-f", "ESRI Shapefile", result_path + query_result, connection_params,"-nlt", "MULTIPOLYGON", "-sql", the_sql_query_here])

Connection and convertion only seems to work for polygons with GeomType 4003 however:

enter image description here

Multipartpolygons or polygons with wholes (GeomType 4007) are completely ignored (white gaps). I already tried to rerun the command above with POLYGON or PROMOTE_TO_MULTI instead of MULTIPOLYGON. No change in the result though.

Any known caveats or workarounds regarding this problem?

My GDAL is v2.1.2


As requested in the comments I publish the geom-content of an object whose geometry couldn't be loaded:

MDSYS.SDO_GEOMETRY(4007,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1005,5,1,2,1,5,2,1,9,2,1,13,2,1,17,2,1,25,1005,5,25,2,1,29,2,1,33,2,1,37,2,1,41,2,1),MDSYS.SDO_ORDINATE_ARRAY(33433109.145,5711835.706,9999.9999,0,33433166.721,5711687.09,9999.9999,0,33433229.435,5711904.544,9999.9999,0,33433205.628,5711904.647,9999.9999,0,33433175.618,5711821.022,9999.9999,0,33433109.145,5711835.706,9999.9999,0,33433020.391,5711673.812,9999.9999,0,33433153.215,5711635.136,9999.9999,0,33433164.011,5711674.531,9999.9999,0,33433099.673,5711838.076,9999.9999,0,33433071.502,5711844.871,9999.9999,0,33433020.391,5711673.812,9999.9999,0))

Corresponding real life object is multipart and looks like this:

enter image description here


While the geometry doesn't get converted, the objects non-spatial attributes and values get fully converted to shape .

  • Could you try to cast the polygons into 3D or 2D with the SQL parameter? – user30184 Aug 16 '18 at 6:18
  • Thx, but I did not find any oracle-sql to cast 'on-the-fly' within a select statement. Also, regarding to role-management I am not able to create views, functions or modify table data directly. I tried the QGIS-loader (3.2.0) now, which seems to have a problem with the missing SRIDof the Oracle-geom-colums. It does not accept a NULL-value. – knutella Aug 16 '18 at 9:11
  • Oh, it probably is very complicated with oracle, see for example this spatialdbadvisor.com/oracle_spatial_tips_tricks/348/…. Could you add one such SDO_GEOMETRY as text into your question? – user30184 Aug 16 '18 at 9:18
  • Added as Edit 1 – knutella Aug 16 '18 at 9:57
  • For the sake of completeness: With Oracles { sdo_cs.make_2d() } -function flatening of 3D geometries into 2D works on the fly. For 4D it has to be used twice. Sadly ogr/GDAL couldn't deal with that either. – knutella Aug 17 '18 at 13:17
0

I can only confirm the issue by running this ogrinfo command:

ogrinfo OCI:user/password@database -sql "select MDSYS.SDO_GEOMETRY(4007,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1005,5,1,2,1,5,2,1,9,2,1,13,2,1,17,2,1,25,1005,5,25,2,1,29,2,1,33,2,1,37,2,1,41,2,1),MDSYS.SDO_ORDINATE_ARRAY(33433109.145,5711835.706,9999.9999,0,33433166.721,5711687.09,9999.9999,0,33433229.435,5711904.544,9999.9999,0,33433205.628,5711904.647,9999.9999,0,33433175.618,5711821.022,9999.9999,0,33433109.145,5711835.706,9999.9999,0,33433020.391,5711673.812,9999.9999,0,33433153.215,5711635.136,9999.9999,0,33433164.011,5711674.531,9999.9999,0,33433099.673,5711838.076,9999.9999,0,33433071.502,5711844.871,9999.9999,0,33433020.391,5711673.812,9999.9999,0)) as geom from dual"

The result is MULTIPOLYGON EMPTY.

Perhaps you would like to send a question to gdal-dev mailing list about this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.