<html>

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">

<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle17
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=blue>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>I think that this is an entirely correct
result, as you are now getting it in the new units, which are degrees, rather
than meters.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>r.b.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <b><span
style='font-weight:bold'>On Behalf Of </span></b>Alan Cunnane<br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, July 19, 2007 2:51
PM<br>
<b><span style='font-weight:bold'>To:</span></b>
postgis-users@postgis.refractions.net<br>
<b><span style='font-weight:bold'>Subject:</span></b> [postgis-users] Distance
query not working after transfrom?</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<div>

<p class=MsoNormal style='margin-right:0in;margin-bottom:12.0pt;margin-left:
.5in'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>Im
having a problem with a distance query after I transformed a set of points to
another SRID. I transformed from easting northing (SRID 27700) to longitude
lattitude (SRID 4326).&nbsp; The problem that I am having is that when I do the
same distance queries using both geom columns I get a completely different
result? I know that the distance query using the first easting northing column
is correct. Here is an example of the different returns I am getting:<br>
<br>
SRID (27700):<br>
<br>
SELECT a.stop_reference, b.stop_reference, distance(a.east_north, b.east_north)
FROM bus_stops1 a, bus_stops1 b WHERE a.stop_reference = 6200206290 AND
b.stop_reference = 6200244450;<br>
<br>
stop_reference | stop_reference |&nbsp;&nbsp;&nbsp;&nbsp; distance<br>
----------------+----------------+------------------<br>
&nbsp;6200206290&nbsp;&nbsp;&nbsp;&nbsp; | 6200244450&nbsp;&nbsp;&nbsp;&nbsp; |
4320.88972319359<br>
<br>
SRID (4326):<br>
<br>
SELECT a.stop_reference, b.stop_reference, distance(a.googlemap, b.googlemap)
FROM bus_stops1 a, bus_stops1 b WHERE a.stop_reference = 6200206290 AND
b.stop_reference = 6200244450;<br>
<br>
stop_reference | stop_reference |&nbsp;&nbsp;&nbsp;&nbsp; distance<br>
----------------+----------------+-------------------<br>
&nbsp;6200206290&nbsp;&nbsp;&nbsp;&nbsp; | 6200244450&nbsp;&nbsp;&nbsp;&nbsp; |
0.041147965100606<br>
<br>
Here is the table I am selecting from:<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Table
&quot;s0679212.bus_stops1&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp; Column&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
| Modifiers<br>
----------------+-----------------------+-----------<br>
&nbsp;stop_reference | character varying(12) | not null<br>
&nbsp;easting&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
| not null<br>
&nbsp;northing&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
| not null<br>
&nbsp;full_location&nbsp; | character varying(50) |<br>
&nbsp;gazetteer_code | character varying(1)&nbsp; |<br>
&nbsp;point_type&nbsp;&nbsp;&nbsp;&nbsp; | character varying(1)&nbsp; |<br>
&nbsp;nat_gazetteer&nbsp; | character varying(7)&nbsp; |<br>
&nbsp;district_name&nbsp; | character varying(24) |<br>
&nbsp;town_name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | character varying(24) |<br>
&nbsp;east_north&nbsp;&nbsp;&nbsp;&nbsp; |
geometry&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
| not null<br>
&nbsp;lat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
double precision&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
&nbsp;lon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
double precision&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>
&nbsp;googlemap&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
geometry&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|<br>
Indexes:<br>
&nbsp;&nbsp;&nbsp; &quot;bus_stops1_pkey&quot; PRIMARY KEY, btree
(stop_reference)<br>
&nbsp;&nbsp;&nbsp; &quot;stops_distance1&quot; gist (east_north)<br>
Check constraints:<br>
&nbsp;&nbsp;&nbsp; &quot;enforce_dims_east_north&quot; CHECK (ndims(east_north)
= 2)<br>
&nbsp;&nbsp;&nbsp; &quot;enforce_dims_googlemap&quot; CHECK (ndims(googlemap) =
2)<br>
&nbsp;&nbsp;&nbsp; &quot;enforce_geotype_east_north&quot; CHECK
(geometrytype(east_north) = 'POINT'::text OR east_north IS NULL)<br>
&nbsp;&nbsp;&nbsp; &quot;enforce_geotype_googlemap&quot; CHECK
(geometrytype(googlemap) = 'POINT'::text OR googlemap IS NULL)<br>
&nbsp;&nbsp;&nbsp; &quot;enforce_srid_east_north&quot; CHECK (srid(east_north)
= 27700)<br>
&nbsp;&nbsp;&nbsp; &quot;enforce_srid_googlemap&quot; CHECK (srid(googlemap) =
4326)<br>
<br>
I created the googlemap column using these commands:<br>
<br>
SELECT AddGeometryColumn( 'bus_stops1', 'googlemap', 4326, 'POINT', 2 );<br>
UPDATE bus_stops1 SET googlemap = transform(setsrid(makepoint(easting,
northing),27700), 4326);<br>
<br>
<br>
Can anyone suggest what on earth could be wrong?<br>
<br>
<br>
<br>
<br>
</span></font></p>

</div>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<div class=MsoNormal align=center style='margin-left:.5in;text-align:center'><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=1 width="100%" align=center>

</span></font></div>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>Yahoo! Mail is the world's favourite email. Don't
settle for less, <a
href="http://uk.rd.yahoo.com/evt=44106/*http:/uk.docs.yahoo.com/mail/winter07.html">sign
up for your free account today</a>.</span></font></p>

</div>

</body>

</html>