<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
Hi All,<div><br></div><div><span class="Apple-style-span" style="color: rgb(42, 42, 42); font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; line-height: 17px; background-color: rgb(255, 255, 255); "><span class="ecxApple-style-span" style="line-height: 17px; color: rgb(42, 42, 42); font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; "><pre style="line-height: 17px; white-space: normal; ">I have two questions to ask:<br style="line-height: 17px; "><br style="line-height: 17px; ">Q1: I have a table that has one geometry column and I want to calculate<br style="line-height: 17px; ">distance (in Km) between two geometries which is in one column. I am using<br style="line-height: 17px; ">select query as under, and wanted to know if this is the right way of doing<br style="line-height: 17px; ">distance calculation between two points. Since, both the points are in one<br style="line-height: 17px; ">table but in different rows so I am using select statement to pick the geom from<br style="line-height: 17px; ">each row.<br style="line-height: 17px; "><br style="line-height: 17px; ">select st_distance_sphere((select the_geom from table_name where<br style="line-height: 17px; ">place_name='PL1'), (select the_geom from table_name where place_name='PL2'))/1000;<br style="line-height: 17px; "><br style="line-height: 17px; "></pre></span><span class="ecxApple-style-span" style="line-height: 17px; color: rgb(42, 42, 42); font-family: monospace; ">Q2: I have a table that has columns distance, direction, place_name and </span><span class="ecxApple-style-span" style="line-height: 17px; color: rgb(42, 42, 42); font-family: monospace; ">geometry (with SRID 4326) as under.</span><span class="ecxApple-style-span" style="line-height: 17px; color: rgb(42, 42, 42); font-family: 'Segoe UI', Tahoma, Verdana, Arial, sans-serif; "><pre style="line-height: 17px; white-space: normal; ">_________________________________________________________<br style="line-height: 17px; "><p class="ecxMsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; "><span style="line-height: 17px; font-size: 10pt; font-family: 'Courier New'; color: rgb(42, 42, 42); ">| Id | distance | direction | Place_name | <span style="line-height: 17px; ">   </span>geom <span style="line-height: 17px; ">   </span><span style="line-height: 17px; ">  </span>|<br style="line-height: 17px; ">--------------------------------------------------------<br style="line-height: 17px; ">|  1 |   42 km  |    E      | PL1        | some geometry|</span></p><p class="ecxMsoNormal" style="line-height: normal; margin-bottom: 0.0001pt; "><span style="line-height: 17px; font-size: 10pt; font-family: 'Courier New'; color: rgb(42, 42, 42); ">---------------------------------------------------------</span></p></pre><pre style="line-height: 17px; white-space: normal; "><br style="line-height: 17px; ">Now I want to calculate new geometry with reference to given geometry based<br style="line-height: 17px; ">on some distance and direction. Such that new geometry is at ?42km E of some<br style="line-height: 17px; ">reference geometry?. Is there a function that can do this? Or if someone can<br style="line-height: 17px; ">point me to a specific link..<br style="line-height: 17px; "><br style="line-height: 17px; "></pre><pre style="line-height: 17px; white-space: normal; ">Looking forward..</pre><pre style="line-height: 17px; white-space: normal; "><br style="line-height: 17px; ">Thanks,<br style="line-height: 17px; "></pre></span><span class="ecxApple-style-span" style="line-height: 17px; color: rgb(42, 42, 42); font-family: monospace; ">YJ</span> </span></div>                                       </div></body>
</html>