So martin this does not really sound like an API change? The contract still says I will return a non null geometry; and you can call isEmpty() on the result? Or did you say in the javadocs that you were going to return an empty multi geometry?

In general I like the idea of a change that lets me chain the methods together in a useful manner. The practice reminds of perl - which should not be taken as encouraging the practice :-)

Comments; this sounds fine - you have a clear motivation. If you can post the javadoc associated with this change I could give you better feedback.
Jody

Martin Davis wrote:
JTS'ers:

I'm considering making a change to the return value of overlay operations (intersection, union, difference, symdifference) which result in an empty geometry. I'm soliciting feedback on whether this seems like a good idea, and whether there are likely to be any compatibility problems.

The SFS spec doesn't specify any behaviour in this situation. Consequently I had to choose some semantics for this situation. At the time I chose to have an overlay operation which results in an empty geometry return a GEOMETRYCOLLECTION EMPTY. This was done with the idea that all operations returning empty would return the same value (a value representing a "null geometry"). However, I now realize that the problem with this approach is that this then prevents overlay operations from being cascaded, since GC's are not supported as input. It seems it might be nicer to return a geometry which is cascadable, and also which provides a bit more information about the situation.

I propose the following rules for determining the geometry type of an empty result value:

intersection(g1, g2) => empty geom with dim = min(dim(g1, g2)
union(g1, g2) => empty geom with dim = max(dim(g1, g2)
difference(g1, g2) => empty geom with dim = dim(g1)
symdifference(g1, g2) => empty geom with dim = max(dim(g1, g2)

Examples:

intersection(POLYGON EMPTY, LINESTRING EMPTY) => LINESTRING EMPTY
union(POLYGON EMPTY, LINESTRING EMPTY) => POLYGON EMPTY
difference(POLYGON EMPTY, LINESTRING EMPTY) => POLYGON EMPTY
symdifference(POLYGON EMPTY, LINESTRING EMPTY) => POLYGON EMPTY

Comments?


_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to