I'm working on an exercise in Oracle Spatial. I want to check if two geometries overlap. I need to use SDO_GEOM.SDO_INTERSECTION to do so, and that's my main difficulty (I know how to do it with RELATE or DISTANCE). So, I'm calling the function and it's returning a geometry:
geomIntersection := SDO_GEOM.SDO_INTERSECTION(geom1,dim,geom2,dim);
How can I check if this geometry is NULL? What does the function return if the two geometries don't have intersection?
EDIT: I'm trying this in SQL Developer 18.2.0.183.
The Oracle version is: Oracle Database 11g Express Edition Release 11.2.0.2.0 – 64bit Production
Best Answer
While Oracle does not have a specific encoding for an empty geometry, it fully understands NULL geometries, and uses that to represent empty geometries. So when you intersect two disjoint geometries, you get a NULL result:
Where things get interesting is when intersecting two adjacent polygons. Then the result is a linestring:
If the two shapes touch at just one point, then the result is a point:
Finally any operation that includes a NULL geometry returns NULL.
Measuring the area of the result of intersecting two disjoint polygons returns null:
If you use any not this in PL/SQL, i.e. assign the result to a variable, then you just check this variable for a NULL result