[postgis-users] Distance query not working after transfrom?

Alan Cunnane alan_cunnane at yahoo.co.uk
Thu Jul 19 11:58:35 PDT 2007


Could you suggest to me how I can the get the result in meters and not degrees?  Thanks very much for your help

----- Original Message ----
From: "Burgholzer,Robert" <rwburgholzer at deq.virginia.gov>
To: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
Sent: Thursday, 19 July, 2007 7:55:07 PM
Subject: RE: [postgis-users] Distance query not working after transfrom?




 
 


<!--
 _filtered {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;}
 _filtered {margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{}
-->






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.


 


r.b.


 


-----Original Message-----

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Alan Cunnane

Sent: Thursday, July 19, 2007 2:51
PM

To:
postgis-users at postgis.refractions.net

Subject: [postgis-users] Distance
query not working after transfrom?


 




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).  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:



SRID (27700):



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;



stop_reference | stop_reference |     distance

----------------+----------------+------------------

 6200206290     | 6200244450     |
4320.88972319359



SRID (4326):



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;



stop_reference | stop_reference |     distance

----------------+----------------+-------------------

 6200206290     | 6200244450     |
0.041147965100606



Here is the table I am selecting from:





            Table
"s0679212.bus_stops1"

     Column    
|         Type         
| Modifiers

----------------+-----------------------+-----------

 stop_reference | character varying(12) | not null

 easting        |
integer              
| not null

 northing       |
integer              
| not null

 full_location  | character varying(50) |

 gazetteer_code | character varying(1)  |

 point_type     | character varying(1)  |

 nat_gazetteer  | character varying(7)  |

 district_name  | character varying(24) |

 town_name      | character varying(24) |

 east_north     |
geometry             
| not null

 lat            |
double precision      |

 lon            |
double precision      |

 googlemap      |
geometry             
|

Indexes:

    "bus_stops1_pkey" PRIMARY KEY, btree
(stop_reference)

    "stops_distance1" gist (east_north)

Check constraints:

    "enforce_dims_east_north" CHECK (ndims(east_north)
= 2)

    "enforce_dims_googlemap" CHECK (ndims(googlemap) =
2)

    "enforce_geotype_east_north" CHECK
(geometrytype(east_north) = 'POINT'::text OR east_north IS NULL)

    "enforce_geotype_googlemap" CHECK
(geometrytype(googlemap) = 'POINT'::text OR googlemap IS NULL)

    "enforce_srid_east_north" CHECK (srid(east_north)
= 27700)

    "enforce_srid_googlemap" CHECK (srid(googlemap) =
4326)



I created the googlemap column using these commands:



SELECT AddGeometryColumn( 'bus_stops1', 'googlemap', 4326, 'POINT', 2 );

UPDATE bus_stops1 SET googlemap = transform(setsrid(makepoint(easting,
northing),27700), 4326);





Can anyone suggest what on earth could be wrong?















 









Yahoo! Mail is the world's favourite email. Don't
settle for less, sign
up for your free account today.





_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users







      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070719/c6e1574c/attachment.html>


More information about the postgis-users mailing list