ora2pg
ora2pg copied to clipboard
INTERNAL conversion uses the srid from the object instead of the meta-data
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.
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.
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)
Commit ec400ad might fix this issue, can you confirm please?