[postgis-devel] Issue 137 in postgis: st_distance, shortestline (, st_maxdistance)

codesite-noreply at google.com codesite-noreply at google.com
Thu Mar 26 04:47:49 PDT 2009


Comment #7 on issue 137 by robe.... at cityofboston.gov: st_distance,  
shortestline (, st_maxdistance)
http://code.google.com/p/postgis/issues/detail?id=137

Nicklas,
I think in those cases, its better to return null rather than an empty  
geometry.  The
main reasons I think its best is that I think that's the way the other  
functions in
PostGIS work when no valid geometry can be given (such as when you  
ST_Simplify
something too much).

The other reason is that if someone is using this to insert/update  a  
geometry
column, then most likely they have a constraint that allows null or a  
linestring or
multilinestring.  If you return empty geometry, they would need to do  
checking to
check if its empty before they can insert -- which adds another level of  
annoyance.

The 3rd reason is that most geos functions don't like GEOMETRY collections  
and barf
when they see one -- so if it is used as a preprocessor for something else  
-- it may
halt execution. (and an empty geometry I think is considered a geometry  
collection --
or hmm maybe we really do support the concept of an empty LINESTRING though  
not sure
what GEOS does with such a thing).  I think Paul may have been working on  
that.

Alternatively I suppose you could return a point (hmm or maybe not since  
you would
still have the annoyance of checking and the function is after all called  
the
shortest_line).

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings



More information about the postgis-devel mailing list