ora2pg icon indicating copy to clipboard operation
ora2pg copied to clipboard

INTERNAL conversion uses the srid from the object instead of the meta-data

Open duursma opened this issue 2 years ago • 3 comments

On converting geometries from srid to epsg is seems that the correct epsg is found, but when using INTERNAL to convert, the conversion takes the srid from the geometry object instead.

duursma avatar Jul 06 '22 07:07 duursma

I am not a specialist of geometry data type so if you can provide an example with the expected PostgreSQL conversion it will be helpful.

darold avatar Jul 09 '22 19:07 darold

And all I know is from reading your code :-(.

In the Ora2Pg::format_data_row an effort is made to find the Oracle srid using parse_sdo_geometry. The SRID coming from that should be converted to EPSG, but only Oracle knows how to do that. Fortunately the converted value has been retrieved earlier in the process and is stored in: $self->{colinfo}->{$table}{"GEOMETRY"}{spatial_srid} (where 'GEOMETRY' is the hard-coded name of the column as I couldn't find how to get that from $idx quickly) So if you change the line: $row->[$idx] = 'SRID=' . $geom_obj->{geometry}{srid} . ';' . $row->[$idx]; using the EPSG value retrieved earlier, it should just work (it worked for me in one use-case, verified with QGIS)

duursma avatar Jul 11 '22 11:07 duursma

Commit ec400ad might fix this issue, can you confirm please?

darold avatar Aug 01 '22 06:08 darold