OK, I'm a newbie to postgis but an old-timer with open source in general.<br><br>Sorry to bother everyone but this problem is driving me a little nuts.<br><br>I've bought the 'postgis in action' book and now I think I still know nothing.<br>
<br>I'm trying to store long lats and do queries on them to establish distance and use that for reporting.<br><br>I'm using this to update the table 'address' <br><br>update address set geog=ST_GeographyFromText('POINT('||lon||' '||lat||')') where id=?;<br>
<br>the address table field 'geog' has this definition:<br><br> geog            geography(Point,4326)  <br><br>When I compare two addresses that I know are around 1800m apart I get this:<br><br>select a.addressline2, a.suburb, ST_Y(a.geog::geometry), ST_X(a.geog::geometry),  b.addressline2,b.suburb,ST_Y(b.geog::geometry), ST_X(b.geog::geometry), ST_distance(a.geog,b.geog ) from address a join address b on <a href="http://b.id">b.id</a>=41491 where <a href="http://a.id">a.id</a>=1238 ;<br>
<br>addressline2  | suburb |    st_y     |    st_x     |  addressline2  |   suburb    |    st_y     |    st_x     |   st_distance    <br>---------------+--------+-------------+-------------+----------------+-------------+-------------+-------------+------------------<br>
 140 Sussex St | Sydney | -33.8692429 | 151.2036312 | 1 Riley Street | Surry Hills | -33.8726426 | 151.2157115 | 1179.61881540556<br><br>Postgis says they are 1179.61m apart.<br clear="all"><br>When I use google maps/yahoo maps/bing maps scale with a good-old fashioned ruler, I get closer to 1800-2000m.<br>
<br>This site says 2230m:<br><br><a href="http://www.daftlogic.com/projects-google-maps-distance-calculator.htm">http://www.daftlogic.com/projects-google-maps-distance-calculator.htm</a><br><br>Is there somewhere I'm missing a magic incantation? I can't find it. Tried geometry instead of geography no solution for me there.<br>
<br>I'm using Postgis 1.5.3-1 ubuntu amd64 11.10<br><br>Thanks if you can help.<br><br>-- <br>Best regards<br><br>Stuart Guthrie<br><br><br><br>