<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-2">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=236160723-30032006>I
thought about this, but on the principal of Occam's Razor decided just to use an
empty GC. This has the advantage that there are fewer cases to handle for
both developers and clients.</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV align=center><FONT face=Arial size=2><STRONG>Martin Davis, Senior Technical
Architect</STRONG><BR><STRONG><FONT color=#0000ff>Vivid Solutions
Inc.
<I>www.vividsolutions.com</I></FONT></STRONG><BR></FONT><EM><FONT face=Arial
size=2>Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5<BR>Phone: (250)
385 6040 - Local 308 Fax: (250) 385 6046</FONT></EM></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
geos-devel-bounces@geos.refractions.net
[mailto:geos-devel-bounces@geos.refractions.net] <B>On Behalf Of </B>Charlie
Savage<BR><B>Sent:</B> March 30, 2006 2:33 PM<BR><B>To:</B> GEOS Development
List<BR><B>Subject:</B> Re: [geos-devel]createEmptyGeometry() createsinstance
ofGeometryCollection<BR><BR></FONT></DIV>Would it make sense to have a
separate EmptyGeometryClass specifically for this
purpose?<BR><BR>Charlie<BR><BR>Martin Davis wrote:
<BLOCKQUOTE
cite=mid5A94289A9268514C8D6C0F1FF44BA0279C3F26@venus.VividSolutions.com
type="cite"><PRE wrap="">This isn't a question of what Geometry.isEmpty() returns. In fact, isEmpty behaves exactly the way you mention - it checks whether there are any points in the Geometry, and returns false if not.
The issue is: what should a method return when it needs to return an empty geometry, but there is no guide about what type of geometry to return? For instance, if you run line.intersect(polygon), and they don't actually intersect, what should be returned? JTS adopts the convention that an empty GeometryCollection is returned. Otherwise, it would have to choose a particular type to return, and this might be misleading.
Actually reviewing this has exposed a minor but probably bad design decision in JTS: empty buffers currently return an empty GC, whereas they should return an empty Polygon (to maintain the exit condition that buffer always returns a polygonal object).
Martin Davis, Senior Technical Architect
Vivid Solutions Inc. <A class=moz-txt-link-abbreviated href="http://www.vividsolutions.com">www.vividsolutions.com</A>
Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
Phone: (250) 385 6040 - Local 308 Fax: (250) 385 6046
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">-----Original Message-----
From: <A class=moz-txt-link-abbreviated href="mailto:geos-devel-bounces@geos.refractions.net">geos-devel-bounces@geos.refractions.net</A>
[<A class=moz-txt-link-freetext href="mailto:geos-devel-bounces@geos.refractions.net">mailto:geos-devel-bounces@geos.refractions.net</A>] On Behalf Of
Mateusz Loskot
Sent: March 30, 2006 2:05 PM
To: GEOS Development List
Subject: Re: [geos-devel] createEmptyGeometry()
createsinstance ofGeometryCollection
Martin Davis wrote:
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">Yes. The spec doesn't cover this, but I chose to use an empty
GeometryCollection as a "typeless" empty geometry, for
</PRE></BLOCKQUOTE><PRE wrap="">methods which
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">need to return one. The createEmptyGeometry method is just a
convenience method for this convention.
</PRE></BLOCKQUOTE><PRE wrap="">OK, I understant it.
</PRE>
<BLOCKQUOTE type="cite"><PRE wrap="">Anyway, what else could that method return that would make sense
(given that it has no type information)?
</PRE></BLOCKQUOTE><PRE wrap="">It depends on the idea behind "empty geometry" or "null
geometry" [1]. As I know, OGC Simple Feature Spec. explains
that empty geometry represents empty point set (empty set of
coordinates). According to my understanding: Point is empty
if it contains "uninitialized" coordinates MultiPoint is
empty if it contains no points in its set. etc.
There is also a distinction between empty and null.
NULL means something undefined, uninitialized - something
unsafe. EMPTY means something well constructor but with empty
set of points. In some case, NULL object can be compared to
EMPTY object with true result.
So, I think isEmpty() function should check the state of the
coordinates set of Geometry return appropriate value (true/false).
[1] Saying "null geometry" I think about logical meaning but
not the physical representation of instance of geometry: null
reference/null pointer.
Cheers
--
Mateusz Łoskot
<A class=moz-txt-link-freetext href="http://mateusz.loskot.net">http://mateusz.loskot.net</A>
_______________________________________________
geos-devel mailing list
<A class=moz-txt-link-abbreviated href="mailto:geos-devel@geos.refractions.net">geos-devel@geos.refractions.net</A>
<A class=moz-txt-link-freetext href="http://geos.refractions.net/mailman/listinfo/geos-devel">http://geos.refractions.net/mailman/listinfo/geos-devel</A>
</PRE></BLOCKQUOTE><PRE wrap=""><!---->_______________________________________________
geos-devel mailing list
<A class=moz-txt-link-abbreviated href="mailto:geos-devel@geos.refractions.net">geos-devel@geos.refractions.net</A>
<A class=moz-txt-link-freetext href="http://geos.refractions.net/mailman/listinfo/geos-devel">http://geos.refractions.net/mailman/listinfo/geos-devel</A>
</PRE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>