ora2pg
ora2pg copied to clipboard
Geometry collection conversion leads to "geometry requires more points"
I have a geometry collection consisting of a polygon followed by a linestring
MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1,179,2,1)
On conversion of the polygon the linestring is 'added' as a 'linear ring' as a result of the look-ahead in the createPolygon. After this the linestring is again added.
This results in something like: GEOMETRYCOLLECTION (POLYGON ((172983.747 572299.66, ..., 172983.747 572299.66), (173003.705 572158.004, 173003.94 572158.022, 173003.705 572158.004)), LINESTRING (173003.705 572158.004, 173003.94 572158.022, 173003.705 572158.004))
I guess the internal 'polygon' is short of a point as a 'closed' polygon may require 4 points.
There are a number of issues that I think (not restricted by any knowledge of the subject): (ref: https://docs.oracle.com/database/121/SPATL/sdo_geometry-object-type.htm#SPATL489, I'll try to check for a more recent version ....)
- the handling for that case seems to resemble the required handling for a COMPOUND_POLYGON_EXTERIOR. But actually there is no 'case' for that ETYPE present in the elsif list.
- the handling of a compound POLYGON doesn't draw's only the sub-elements which should interconnect and form a polygon.
- the handling looks for the first non-POLYGON_INTERIOR. But the actual count should be in the interpretation. If can image that the compound polygon is followed by a normal polygon. But the current code would just skip that additional polygon(s)
- and actually it should skip LINESTRING's only as only those can be subelements of a compound polygon
- in the createPolygon the following should only handle and skip the next items if the current ETYPE is one of the compound polygons types.
- the method allows a LINESTRING to be a subelement, but according to the documentation I found, that should be the only allowed elements.
Based on the above my current transformation result is caused by the handling of the LINESTRING as subelement. But as a LINESTRING it is not skipped and repeated in the output.