[postgis-devel] Geography <-> Geometry casts

Sandro Santilli strk at keybit.net
Thu Jan 12 06:02:30 PST 2012


On Thu, Jan 12, 2012 at 08:12:29AM -0500, Paragon Corporation wrote:
> 
> > Yes, an implicit geography->geometry cast would be much more 
> > useful than the reverse. I have no recollection of the 
> > reasons why we don't have it, but I'm sure there's a good one.
> > P.
> 
> I really hope this line of thinking is over, but in case it is not.
> Here is an example why autocasting from geography -> geometry is bad bad
> bad.  Note since
> most geometry functions are overloaded in geography, its not quite so much
> of an issue as you 
> are unlikely to run into logical confusing cases like this example: 
> 
> Example: If we have auto casting between geography -> geometry
> 
> and I do:
> 
> SELECT ST_Union(geography)
> 
> ...
> 
> Yikes, I get back a geometry object.  How on earth are you going to explain
> why ST_Buffer(geography) --> geography
> 
> and:
> ST_Union(geography) --> geometry

Both the above ones are non-issues IFF there's an override.
I guess you're concerned about the case in which there is _not_ an override ?
Wouldn't such cases basically be bugs ?

--strk; 

  ()   Free GIS & Flash consultant/developer
  /\   http://strk.keybit.net/services.html



More information about the postgis-devel mailing list