[geos-devel] JTS - Change to semantics of overlay operations with EMPTY outputs

Sandro Santilli strk at keybit.net
Tue Feb 28 03:26:48 EST 2012


On Mon, Feb 27, 2012 at 09:54:56PM -0800, Martin Davis wrote:

> * 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)

I think it'd make more sense to use the highest, because it would be

  ST_Union( ST_Difference(A, B), ST_Difference(B, A) )

Which for your previous definitions means:

> * 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

  ST_Union( dims(A), dims(B) )

Which in turn gives:

> * For union, the output will have the type of the highest-dimension input
>      E.g.
>     union(POLYGON EMPTY, LINESTRING EMPTY) = POLYGON EMPTY

  maxDim(A, B)

So symDifference(A, B) should have type of highest dimension input.
Does it make sense ?

--strk;

  ,------o-. 
  |   __/  |    Delivering high quality PostGIS 2.0 !
  |  / 2.0 |    http://strk.keybit.net - http://vizzuality.com
  `-o------'



More information about the geos-devel mailing list