[postgis-tickets] [PostGIS] #2965: ST_Distance, use_spheroid default
PostGIS
trac at osgeo.org
Thu Oct 23 21:49:40 PDT 2014
#2965: ST_Distance, use_spheroid default
-----------------------+----------------------------------------------------
Reporter: gitai | Owner: pramsey
Type: defect | Status: closed
Priority: critical | Milestone: PostGIS 2.1.5
Component: postgis | Version: 2.1.x
Resolution: wontfix | Keywords: ST_Distance, use_spheroid
-----------------------+----------------------------------------------------
Comment(by robe):
gitai -- I don't think there is a way to satisfy this request short of
what Pramsey is saying of removing the autocast in geometry::geography
which many have complained about so would be a good enhancement in my
book.
Both geometry and geography have ST_Distance functions (that take no
additional args but the spatial objects) and geography is the only one to
take the additional use_spheroid option which is how you managed to fall
into the lucky trap.
So when you use the 2 argument one since you have 2 geometries it goes
into the best fitting function (that ST_Distance that takes geometries).
When you pass it the additional arg, only the geography version has the
extra arg -- and geometry says -- hey I can pretend to be a geography to
get myself in this door. By the time it gets into the function door, it
already has been cast to a geography so there is no way we can provide a
hint to say "hey dude you just morphed yourself into a geography".
So the fact you happened to waltz into the right geography function when
passing your geometries in is nothing we can protect you from short of
removing the autocast or renaming our functions to have Geom / Geog in
name. Such a renaming would annoy a lot of people. However I do think
many people (I included) would like the proposed get rid of the autocast.
The autocast bytes you in very subtle ways like when when doing &&
between a geometry and geograpy
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2965#comment:17>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list