Hi folks,
I am working through some issues validating geometries being passed into Oracle Spatial via GML 3. A small number of polygons are coming in with 13349 errors. Looking closer I see they all involve situations where there is a hole touching the outer ring at a single point. The GML is representing this hole as part of the exterior ring. Here is a simplified example with bad ascii art (be nice if the forum had some way to post pictures):
A----------B
|..........|
E----F.....|
|\ |.....|
|.\ |.....|
|..\ |.....|
|....G.....|
|..........|
D----------C
So a valid Oracle Spatial polygon would be an outer ring of A.B,C,D,E,A and an inner ring of E,F,G,E.
However, the GML is arriving as one outer ring of A,B,C,D,E,G,F,E,A which once loaded into Oracle Spatial throws the 13349 error. SDO_UTIL.FROM_GML311GEOMETRY does not fix this error but just passes it through.
I spent some time going over the GML documentation and it does not appear the GML polygon standard expressly states any rules on the matter. This paper,
http://www.gdmc.nl/publications/2004/Invalid_Valid_Clean_Polygons.pdf
seems to support that statement. When talking about ISO 19107 which is the basis of the GML polygon object, the author says “Further, it is not directly obvious if the outer boundary is allowed to touch itself or if it is allowed to touch the inner boundaries and if so, under what conditions this would be allowed.”
Does this sound right to all of you?
Note that the WKT specification in contrast does actually state that these holes should be stored the same as Oracle Spatial. So this is a GML only issue.
So assuming that the GML specification allows the storage of polygons with holes of either type, it would seem its up to us on the Oracle Spatial side of things to fix the situation when we encounter it? I'd suggest that perhaps SDO_UTIL.FROM_GML311GEOMETRY should detect and fix this as a matter of course but I know from the WKT ring rotation issue (
3223747 that the Oracle Spatial position is that correction of such incoming errors is the individual user's problem to address. Does anyone have any thoughts on the matter?
Note that SDO_UTIL.RECTIFY_GEOMETRY does not seem to fix the problem. I need to write a wrapper to walk the ring vertices and sniff for duplicate vertices and then spin off a hole when the situation is found. Am I missing anything?
Thanks and Happy Friday,
Paul