[postgis-devel] What is the reliability of a cast to geography

Paragon Corporation lr at pcorp.us
Mon Dec 15 23:57:38 PST 2014


> Hi all,

> Can one expect that a cast from geom::geography will always succeed? 

No.  It will fail if your geometry is in a known SRID other than 4326 (well
in 2.1.4 plus I think we changed so other long lat coordinates are accepted,
but a bug prior to that prevented it from working with other long lat srids
So we won't broadcast this feature until 2.2 especially since not well
tested)

It will work for unknown (0) as long as your coordinates fit in the long/lat
-180, 180 -90, 90 range

Others will throw an error.

( I
> need to ensure that a function always receives distance in meters. )

> Thanks,

> Nathaniel Hunter Clay

ST_Distance_Sphere and / Spheroid are technically what should be used,
though I've been avoiding these since I expect someone will rename them soon
and break all my code :)

Hope that helps,
Regina
http://www.postgis.us
http://postgis.net






More information about the postgis-devel mailing list