[postgis-users] Re: Nitpicking empty geometries

Rolf A. de By deby at itc.nl
Thu Jun 12 13:25:10 PDT 2008

Martin, big thanks for your elaboration.  You wrote:

>I don't think that the SFS requires GeometryCollections to be 
>non-empty.  If you think it does, can you provide a page & section number?

In the hope that OGC 99-049 rev 1.1 is still considered a valid reference on this,
section 2.1.2, page 2-4 states "A GeometryCollection is a geometry that is
a collection of 1 or more geometries."

>The reason that intersection() returns GC EMPTY as its null return value 
>is that this is the standard value that JTS/GEOS uses to indicate null 

And I was just telling my students today that a null geometry is very
different from an empty geometry in a PostGIS database ;-)  The first
being a "don't know geometry"; the second being empty, as in the distribution
of an extinct biological species.

>It was thought that it was better to have a single "null" 
>value, rather than trying to return an empty geometry of a different 
>type.  (For instance, what would be the null return value for 
>intersection(POLYGON, LINESTRING)?)

I totally agree that a single empty geometry only is what we want and that
it is in line with the apparent strive for uniqueness of geometric objects
in the standards.  (Well, that is how I rationalize some of the correctness
rules for polygons, at least.)

>However, this is a somewhat arbitrary design decision, and it may be 
>that it would better to always have intersection etc. return "the most 
>correct type".  Or perhaps it should return the type of smallest dimension?

I see the point you are making but I'd say that because the result of an
intersection can at least always be viewed as a geocollection, then that
is actually the most appropriate type for the empty result.

My point was that I would expect to see st_geometrytype() then return
"ST_GEOMETRYCOLLECTION" but it does not.

>This would have the advantage that overlay ops would then always return 
>a value which could be used in further overlay ops.

Hmm, that remark makes me wonder whether you aren't giving the answer to
my original question . . . 


International Institute for Geo-Information Science and Earth Observation (ITC)
Chamber of Commerce: 410 27 560

E-mail disclaimer
The information in this e-mail, including any attachments, is intended for the addressee only. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or action in relation to the content of this information is strictly prohibited. If you have received this e-mail by mistake, please delete the message and any attachment and inform the sender by return e-mail. ITC accepts no liability for any error or omission in the message content or for damage of any kind that may arise as a result of e-mail transmission.

More information about the postgis-users mailing list