ora2pgpro fully exports spatial objects from Oracle databases. There are some configuration directives that could be used to control the export.
AUTODETECT_SPATIAL_TYPE
By default, ora2pgpro is looking at indexes to see the spatial constraint type and dimensions defined under Oracle. Those constraints are passed at index creation using for example:
CREATE INDEX ... INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS('sdo_indx_dims=2, layer_gtype=point');
If those Oracle constraints parameters are not set, the default is to export those columns as generic type GEOMETRY to be able to receive any spatial type.
The
AUTODETECT_SPATIAL_TYPE
directive allows to force ora2pgpro to autodetect the real spatial type and dimensions used in a spatial column otherwise a non-constrained geometry type is used. Enabling this feature will force ora2pgpro to scan a sample of 50000 column to look at the GTYPE used. You can increase or reduce the sample size by setting the value ofAUTODETECT_SPATIAL_TYPE
to the desired number of line to scan. The directive is enabled by default.For example, in the case of a column named
shape
and defined with Oracle type SDO_GEOMETRY, withAUTODETECT_SPATIAL_TYPE
disabled, it will be converted as:shape geometry(GEOMETRY) or shape geometry(GEOMETRYZ, 4326)
If the directive is enabled and the column just contains a single geometry type that uses a single dimension with a two or three dimensional polygon:
shape geometry(POLYGON, 4326) or shape geometry(POLYGONZ, 4326)
CONVERT_SRID
This directive allows you to control the automatic conversion of Oracle SRID to standard EPSG. If enabled, ora2pgpro will use the Oracle function
sdo_cs.map_oracle_srid_to_epsg()
to convert all SRIDs. Enabled by default.If the
SDO_SRID
returned by Oracle is NULL, it will be replaced by the default value 8307 converted to its EPSG value: 4326 (seeDEFAULT_SRID
).If the value is more than 1, all SRIDs will be forced to this value, in this case
DEFAULT_SRID
will not be used when Oracle returns a null value and the value will be forced toCONVERT_SRID
.Note that it is also possible to set the
EPSG
value on Oracle side whensdo_cs.map_oracle_srid_to_epsg()
returns NULL if your want to force the value:system@db> UPDATE sdo_coord_ref_sys SET legacy_code=41014 WHERE srid = 27572;
DEFAULT_SRID
Use this directive to override the default EPSG SRID to be used: 4326. Can be overwritten by
CONVERT_SRID
, see above.GEOMETRY_EXTRACT_TYPE
This directive can take three values:
WKT
(default),WKB
, andINTERNAL
. When it is set toWKT
, ora2pgpro will useSDO_UTIL.TO_WKTGEOMETRY()
to extract the geometry data. When it is set toWKB
, ora2pgpro will use the binary output usingSDO_UTIL.TO_WKBGEOMETRY()
. If those two extract types are calls at Oracle side, they are slow and you can easily reach Out Of Memory when you have a lot of rows. AlsoWKB
is not able to export 3D geometry and some geometries likeCURVEPOLYGON
. In this case you may use theINTERNAL
extraction type. It will use a Pure Perl library to convert theSDO_GEOMETRY
data into aWKT
representation, the translation is done on ora2pgpro side. This is a work in progress, validate your exported data geometries before use. Default spatial object extraction type isINTERNAL
.POSTGIS_SCHEMA
Use this directive to add a specific schema to the search path to look for PostGIS functions.
ST_SRID_FUNCTION
Oracle function to use to extract the SRID from
ST_Geometry
meta information. Default:ST_SRID
, for example, it should be set tosde.st_srid
for ArcSDE.ST_DIMENSION_FUNCTION
Oracle function to use to extract the dimension from
ST_Geometry
meta information. Default:ST_DIMENSION
, for example it should be set tosde.st_dimention
for ArcSDE.ST_GEOMETRYTYPE_FUNCTION
Oracle function to use to extract the geometry type from a
ST_Geometry
column. Default:ST_GEOMETRYTYPE
, for example it should be set tosde.st_geometrytype
for ArcSDE.ST_ASBINARY_FUNCTION
Oracle function to be used to convert an
ST_Geometry
value intoWKB
format. Default:ST_ASBINARY
, for example it should be set tosde.st_asbinary
for ArcSDE.ST_ASTEXT_FUNCTION
Oracle function to be used to convert an
ST_Geometry
value intoWKT
format. Default:ST_ASTEXT
, for example it should be set tosde.st_astext
for ArcSDE.