[postgis-devel] ST_distance_sphere changes in 2.0?

J Smith dark.panda+lists at gmail.com
Wed Jul 20 13:54:08 PDT 2011


G'day list.

I was just messing around with the latest PostGIS 2.0 trunk and was
running a unit test suite I have and noticed that ST_distance_sphere
is returning some strange results. Here's the query I was running:

SELECT ST_distance_sphere('POLYGON((-5 -5,-5 5,5 5,5 -5,-5 -5))', 'POINT(1 1)');

Which results in 444712.466496141 in the current trunk.
postgis_full_version() says:

POSTGIS="2.0.0SVN" GEOS="3.3.0-CAPI-1.7.0" PROJ="Rel. 4.7.1, 23
September 2009" LIBXML="2.7.8" USE_STATS

Whereas in PostGIS 1.5.3 I see a result of 0. postgis_full_version():

POSTGIS="1.5.3" GEOS="3.3.0-CAPI-1.7.0" PROJ="Rel. 4.7.1, 23 September
2009" LIBXML="2.7.8" USE_STATS

Both PostGIS installs are on the same PostgreSQL 9.0.4 server.

Does this make sense? I would have assumed the result should be 0
since the point lies within the polygon, but I thought I'd check here
to be sure as I couldn't find a ticket concerning ST_distance_sphere
or ST_distance_spheroid and I'm not sure what to expect.

Cheers



More information about the postgis-devel mailing list