Open jieguolove opened 2 years ago
This discovery may be helpful to fix the bug of ora2pg: in oracle: select st_astext (shape) from jzsh_lsd_maint_unionbase_84 where enbid='15181' use the ST_GeomFromText function in the pg to convert this string into a spatial string and store it in the pg.
in pg: The point coordinate space table can be processed directly, and the area space table needs to replace the string transferred by the st_astext function during ST_GeomFromText to the pg.
temp sloved: sed -i 's/SRID=;//g' .sql sed -i 's/ nan/ -1.797693134862316e+308/g' .sql
Hi, thanks for the report. Can you provide me the value of GEOMETRY_EXPORT_TYPE in your ora2Pg.conf?
Hi, thanks for the report. Can you provide me the value of GEOMETRY_EXPORT_TYPE in your ora2Pg.conf?
There is no such parameter in my ora2Pg.conf
Sorry, this is GEOMETRY_EXTRACT_TYPE
Sorry, this is GEOMETRY_EXTRACT_TYPE same, There is no such parameter in my ora2Pg.conf
Can you post the configuration with the usual anonymization?
data.conf:
PG_VERSION 12 ORACLE_HOME /oracle/app/oracle/product/11.2.0/dbhome_1 ORACLE_DSN dbi:Oracle:host=192.168.1.100;sid=db;port=1521 ORACLE_USER test ORACLE_PWD password SCHEMA test PG_NUMERIC_TYPE 0 PG_INTEGER_TYPE 1 DEFAULT_NUMERIC float NLS_LANG AMERICAN_AMERICA.UTF8
export command:
ora2pg -p -c data.conf -t COPY -a 'TABLE[SDETABLE]' -o sdetable.sql
The problem is probably because you are using an ST_GEOMETRY data type and the method to retrieve the SRID is not compatible and commit ec400ad is of no help in this case. For SDO_GEOMETRY Ora2Pg use the following query:
SELECT COALESCE(SRID, $self->{default_srid}) FROM ALL_SDO_GEOM_METADATA
WHERE TABLE_NAME='<tablename>' AND COLUMN_NAME='<colname>' AND OWNER='<owner>';
@jieguolove do you know the query that should be used for ST_GEOMETRY?
Hi @darold
I'm actually encountering the same issue converting from SDE to postgis, with the following spatial configuration. GEOMETRY_EXTRACT_TYPE to INTERNAL, WKB... WKT works however. But I thought I'd share the feedback anyway.
Let me know if you need further info.
logs: FATAL: ERROR: parse error - invalid geometry HINT: "SR" <-- parse error at position 2 within geometry CONTEXT: COPY argo_coverage_year_hs, line 1, column shape: "SRID=;POLYGON (( -87.00000000 -57.00000000, -84.00000000 -57.00000000, -84.00000000 -54.00000000, -..."
conf: AUTODETECT_SPATIAL_TYPE 1
CONVERT_SRID 0
DEFAULT_SRID 4326
GEOMETRY_EXTRACT_TYPE INTERNAL
ST_GEOMETRYTYPE_FUNCTION sde.st_geometrytype ST_SRID_FUNCTION sde.st_srid ST_DIMENSION_FUNCTION sde.st_dimension ST_ASBINARY_FUNCTION sde.st_asbinary ST_ASTEXT_FUNCTION sde.st_astext
Bonjour @darold ,
J'ai l'impression d'avoir le même problème.
J'ai une table Oracle avec des colonnes SDO_GEOMETRY
CREATE TABLE XXX.ICSP
(
GEOM_L2E MDSYS.SDO_GEOMETRY,
GEOM_WGS84 MDSYS.SDO_GEOMETRY,
GEOM_L93 MDSYS.SDO_GEOMETRY
)
J'ai mis à jour la table sdo_coord_ref_sys pour que les conversions des srid => EPSG se fasse correctement
La génération des scripts SQL de création des tables est ok
CREATE TABLE icsp (
...
geom_l2e geometry(POINT,27572),
geom_wgs84 geometry(POINT,4326),
geom_l93 geometry(POINT,2154)
) ;
Cependant le SQL produit par la commande:
ora2pg -c config/ora2pg.conf -t COPY -a ICSP -b ./data -o icsp_table.sql -d
Me fournit ce genre de résultat (en gros, j'ai un SRID=; en trop partout...)
COPY icsp (code_icsp,origine_code,nom_icsp,x_icsp,y_icsp,projection_icsp,precision_icsp,date_mise_en_service,date_mise_hors_service,commentaires_icsp,commune_icsp,secteur_activite_principal,code_ape_etablissement,nomutil,x_lamb_93,y_lamb_93,gid,xouvl2e,youvl2e,longitude,latitude,num_departement,agence,region,district,geom_l2e,geom_wgs84,geom_l93,code_naf_2008) FROM STDIN;
SRID=;RHA69_00086 SRID=;GENMOLOSSE SRID=;SOCIETE DU DEPOT DE ST PRIEST SRID=;800930 SRID=;2079910 SRID=;5 SRID=;3 \N \N SRID=;Siret : 399087220 SRID=;69290 SRID=;4 SRID=;51.5A SRID=;DRIRERHA SRID=;849132 SRID=;6511842 SRID=;1641 SRID=;800930 SRID=;2079910 SRID=;4.91632963296735 SRID=;45.6898639249745 SRID=;69 SRID=;AGO5 SRID=;REG82 SRID=;D SRID=27572;POINT (800929.987299754 2079909.99961538) SRID=4326;POINT (4.91632963296735 45.6898639249745) \N \N
SRID=;RHA69_00087 SRID=;GENMOLOSSE SRID=;KODAK SRID=;790050 SRID=;2070290 SRID=;5 SRID=;3 \N \N SRID=;Siret : inconnu SRID=;69096 SRID=;5 SRID=;74.8A SRID=;DRIRERHA SRID=;838180 SRID=;6502324 SRID=;1642 SRID=;790050 SRID=;2070290 SRID=;4.77290480645298 SRID=;45.6064832261955 SRID=;69 SRID=;AGO5 SRID=;REG82 SRID=;D SRID=27572;POINT (790049.987283841 2070289.99963591) SRID=4326;POINT (4.77290480645298 45.6064832261955) \N \N
SRID=;RHA69_00089 SRID=;GENMOLOSSE SRID=;SOCIETE TEXTILE INDUSTRIELLE DU RHONE - STIR SRID=;798210 SRID=;2086890 SRID=;5 SRID=;3 \N \N SRID=;Siret : inconnu SRID=;69383 SRID=;6 SRID=;17.3Z SRID=;DRIRERHA SRID=;846474 SRID=;6518839 SRID=;1643 SRID=;798210 SRID=;2086890 SRID=;4.88433476257371 SRID=;45.7534250160617 SRID=;69 SRID=;AGO5 SRID=;REG82 \N SRID=27572;POINT (798209.987314235 2086889.99962165) SRID=4326;POINT (4.88433476257371 45.7534250160617) \N \N
SRID=;RHA69_00092 SRID=;GENMOLOSSE SRID=;STATION SERVICE ELF - Tassin SRID=;789440 SRID=;2086820 SRID=;5 SRID=;3 \N \N SRID=;Siret : inconnu SRID=;69244 SRID=;14 SRID=;50.5Z SRID=;DRIRERHA SRID=;837712 SRID=;6518844 SRID=;1644 SRID=;789440 SRID=;2086820 SRID=;4.77165119444173 SRID=;45.7552955085604 SRID=;69 SRID=;AGO5 SRID=;REG82 SRID=;D SRID=27572;POINT (789439.987316611 2086819.99963918) SRID=4326;POINT (4.77165119444173 45.7552955085604) \N \N
Je vais probablement utiliser la solution suivante temporairement
sed -i 's/SRID=;//g' *.sql
Une idée?
Merci Frederic
The table structure of the Oracle database is as follows:
Oracle spatial data exported with the latest version of ora2pg is in the following format and cannot be imported into the postgresql database:
The table structure of the postgresql database is as follows:
HOW TO FIX ora2pg? thanks!