<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
That works great.&nbsp; Thanks for all the help.<BR>
<BR><BR>&gt; Date: Thu, 20 Mar 2008 13:25:35 -0700<BR>&gt; From: kneufeld@refractions.net<BR>&gt; To: postgis-users@postgis.refractions.net<BR>&gt; Subject: Re: [postgis-users] How to get the distance between geometry inmeters?<BR>&gt; <BR>&gt; Ah. So your first attempt is incorrect. When you first create your <BR>&gt; geometries, you need to set the srid of your new geometries to the <BR>&gt; projection they are currently in. Since your input is lat/long, you need <BR>&gt; to set the srid of your new geometries to the lat/long projection. <BR>&gt; *Then* you can transform your geometries into 26912 and query for things <BR>&gt; like distance.<BR>&gt; <BR>&gt; Try this:<BR>&gt; select AddGeometryColumn('table','geocode', 26912, 'POINT', 2);<BR>&gt; update table<BR>&gt; set geocode = transform(PointFromText('POINT(' || longitude || ' ' || <BR>&gt; latitude || ')', 4269), 26912);<BR>&gt; <BR>&gt; -- or better, since going through the text representation introduces <BR>&gt; coordinate drifting.<BR>&gt; select AddGeometryColumn('table','geocode', 26912, 'POINT', 2);<BR>&gt; update table<BR>&gt; set geocode = transform(setsrid(MakePoint(longitude, latitude), 4269), <BR>&gt; 26912);<BR>&gt; <BR>&gt; then distance(geocode, geocode) will return meters.<BR>&gt; <BR>&gt; I hope this clarifies things.<BR>&gt; Cheers,<BR>&gt; Kevin<BR>&gt; <BR>&gt; R H wrote:<BR>&gt; &gt; My explanation wasn't that great. Below is what I did.<BR>&gt; &gt; <BR>&gt; &gt; 26912 projection is in meters (right?)<BR>&gt; &gt; select AddGeometryColumn('table','geocode', 26912, 'POINT', 2);<BR>&gt; &gt; update table<BR>&gt; &gt; set geocode = PointFromText('POINT(' || longitude || ' ' || latitude <BR>&gt; &gt; || ')', 26912);<BR>&gt; &gt; distance(geocode, geocode) returns degrees<BR>&gt; &gt; <BR>&gt; &gt; ALTER TABLE property DROP COLUMN geocode<BR>&gt; &gt; <BR>&gt; &gt; 4269 projection in degrees<BR>&gt; &gt; select AddGeometryColumn('table','geocode', 4269, 'POINT', 2);<BR>&gt; &gt; update table<BR>&gt; &gt; set geocode = PointFromText('POINT(' || longitude || ' ' || latitude <BR>&gt; &gt; || ')', 4269);<BR>&gt; &gt; distance(transform(geocode, 26912), transform(geocode,26912)) returns <BR>&gt; &gt; meters<BR>&gt; &gt;<BR>&gt; &gt; <BR>&gt; &gt; I would prefer not to do the transform() if don't have to speed and <BR>&gt; &gt; accuracy reasons. Thanks for help. : }<BR>&gt; &gt; <BR>&gt; _______________________________________________<BR>&gt; postgis-users mailing list<BR>&gt; postgis-users@postgis.refractions.net<BR>&gt; http://postgis.refractions.net/mailman/listinfo/postgis-users<BR><BR></body>
</html>