[postgis-users] Distances off in the Southern US

Mike Hostetler mike at squarepegsystems.com
Mon Aug 15 03:50:30 PDT 2011


Hello,

I'm somewhat new to GIS and I have a problem that I thought appeared to be
simply using a wrong projection or datum, but it seems to be a bit more
subtle than that.

I have a table of cities in the US and I'm trying to find distances between
them. When I use a city that is in the northern US, it works fine.  When I
try to find the distance between two cities in the Southern US, the distance
becomes way off.

I setup a Geometry in my cities table and populated it like the following:

select AddGeometryColumn('cities','geom',32661,'POINT',2);
UPDATE cities SET  geom=transform(setsrid(makepoint(longitude,
latitude),4269), 32661)

(I find the latitude and longitude from the Yahoo Geocode service)

A distance calc from McHenry, IL to Dallas, TX is calculated as:
select distance( (select geom from cities where id=26251), (select geom from
cities where id=67) )*0.000621371192 as miles;
     miles
------------------
 996.717850542391
(Google Maps reads as 972, off by 25 miles or off around 4%)


But Birmingham, AL, to Miami, FL is calculated as:
leader=# select distance( (select geom from cities where id=26251), (select
geom from cities where id=67) )*0.000621371192 as miles;
      miles
------------------
 996.717850542391
(Google Maps reads as 767, off by 120 files, or 13%).

I can handle a little error, as long as it's somewhat small (<5%).  But this
is way off.

Again, it smells to be to be a datum or projection issue to me, but I'm not
sure how to find the sweet spot to be accurate everywhere.

Your input is appreciated.


-- 
Mike Hostetler
SquarePeg Systems
http://www.squarepegsystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110815/c87bd7f5/attachment.html>


More information about the postgis-users mailing list