[geos-devel] JTS - Change to semantics of overlay operations with
EMPTY outputs
Martin Davis
mtnclimb at telus.net
Tue Feb 28 00:54:56 EST 2012
As a result of some recent discussion on the JTS list, I am thinking of
changing the semantics of overlay operations with EMPTY outputs to
return more narrowly typed geometries, instead of the current situation
where GEOMETRYCOLLECTION EMPTY is returned. This will allow easier
cascading of overlay operations (since overlay ops do not currently
accept GEOMETRYCOLLECTIONs as input).
I'm proposing the following rules (which are extrapolated from the
behaviour of situations with non-empty results):
* For intersection, the output will have the type of the
lowest-dimension input
E.g.
intersection(POLYGON EMPTY, LINESTRING EMPTY) = LINESTRING EMPTY
* For union, the output will have the type of the highest-dimension input
E.g.
union(POLYGON EMPTY, LINESTRING EMPTY) = POLYGON EMPTY
* For difference, the output will have the type of the left-hand input
E.g.
difference(POLYGON EMPTY, LINESTRING EMPTY) = POLYGON EMPTY
difference(LINESTRING EMPTY, POLYGON EMPTY) = LINESTRING EMPTY
* For symmetric difference, the output will have the type of the
lowest-dimension input
E.g.
symDifference(POLYGON EMPTY, LINESTRING EMPTY) = LINESTRING EMPTY
symDifference(LINESTRING EMPTY, POLYGON EMPTY) = LINESTRING EMPTY
(This is pretty arbitrary, but no other criteria comes to mind)
Comments are welcome.
More information about the geos-devel
mailing list