[postgis-users] Distances off in the Southern US

Paul Ramsey pramsey at opengeo.org
Mon Aug 15 09:04:49 PDT 2011


You're using polar stereograpic as your projection?

http://nsidc.org/data/atlas/epsg_32661.html

Well, yes, the farther south you go, the more over-determined your
distance will be.

Use the geography type, as suggested below, or the
st_distance_spheroid() function, or just use a projection that is more
conformal for the area of interest (continental USA?
http://prj2epsg.org/epsg/2163)

P.

On Mon, Aug 15, 2011 at 3:50 AM, Mike Hostetler
<mike at squarepegsystems.com> wrote:
> 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
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>



More information about the postgis-users mailing list