[postgis-devel] Geography <-> Geometry casts

Sandro Santilli strk at keybit.net
Wed Jan 11 06:40:57 PST 2012


Can anyone please explain why we have an IMPLICIT geometry->geography
cast while we don't have geography->geometry as IMPLICIT ?

The most convincing explanation I got so far arrived from Regina
mentioning it had to do with queries of the form:

 Geography && Geometry

becoming ambiguos.

If that's the only reason, wouldn't it be the same if we made the
Geography->Geometry IMPLICIT rather than the other way around ?
I can see it won't help the && case but would help all the others
like ST_AsBinary, GeometryType etc.

The examples above (AsBinary, GeometryType) come from qgis code.

I'm about to add wrappers for ST_AsBinary(geography) to avoid
touching client code expecting that to work, but doing so by
extension would mean overriding each and every geometry function.

Isn't it more common to threat a geography as a geometry rather
than the other way around, in absence of overrides ?

--strk; 

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



More information about the postgis-devel mailing list