<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 9.00.8112.16450"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 
face=Arial></FONT> </DIV>
<DIV><SPAN class=777002605-09102012></SPAN><FONT color=#0000ff size=2 
face=Arial>R<SPAN 
class=777002605-09102012>e</SPAN>ad first chapter of our book<SPAN 
class=777002605-09102012> (which is a free 
download)</SPAN>. The example<SPAN class=777002605-09102012>s at the 
end</SPAN> covers exactly what you are asking.</FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT 
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><A 
href="http://www.manning.com/obe/">http://www.manning.com/obe/</A></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=777002605-09102012><FONT color=#0000ff size=2 face=Arial>Also 
if you don't know much about SQL, the free Appendix C covers the fundamentals of 
SQL.</FONT></SPAN></DIV>
<DIV><SPAN class=777002605-09102012><FONT color=#0000ff size=2 
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=777002605-09102012><FONT color=#0000ff size=2 
face=Arial>Leo</FONT></SPAN></DIV>
<DIV><SPAN class=777002605-09102012><FONT color=#0000ff size=2 face=Arial><A 
href="http://www.postgis.us">http://www.postgis.us</A></FONT></SPAN></DIV>
<DIV><SPAN class=777002605-09102012></SPAN> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=777002605-09102012></SPAN></FONT></FONT></FONT> </DIV>
<DIV><BR></DIV>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> 
postgis-users-bounces@postgis.refractions.net 
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of 
</B>tasneem dewaswala<BR><B>Sent:</B> Tuesday, October 09, 2012 1:22 
AM<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> Re: [postgis-users] 
finding whether an object lies in vicinity of another 
object<BR></FONT><BR></DIV>
<DIV></DIV>Hello,
<DIV>Thank you for your reply.</DIV>
<DIV><BR></DIV>
<DIV>I have added a geometry column to my existing table.</DIV>
<DIV>But i am facing problems in updating that column.</DIV>
<DIV>since i have thousands of row, it would not be feasible to update each row 
at a time. </DIV>
<DIV>what should i do to update all geometries at once? <BR></DIV><BR>
<DIV class=gmail_quote>On Mon, Oct 8, 2012 at 6:32 PM, Tom van Tilburg <SPAN 
dir=ltr><<A href="mailto:tom.van.tilburg@gmail.com" 
target=_blank>tom.van.tilburg@gmail.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE 
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" 
class=gmail_quote>
  <DIV text="#000000" bgcolor="#FFFFFF">
  <DIV>Hi Tasneem,<BR><BR>You will have to create a geometry first before you 
  can use postgis functions. Just 2 columns with coordinates are not enough 
  (you're very close though). <BR>I would recommend to do some reading in the 
  manual, especially here:<BR><A 
  href="http://postgis.refractions.net/documentation/manual-2.0/PostGIS_FAQ.html#id605751" 
  target=_blank>http://postgis.refractions.net/documentation/manual-2.0/PostGIS_FAQ.html#id605751</A><BR><BR>It 
  boils down to adding a column with <BR><PRE>      SELECT AddGeometryColumn('', 'yourtable','geom',-1,'POINT',2);</PRE>and 
  then filling the column with <BR>    UPDATE yourtable SET geom 
  = ST_SetSrid(ST_MakePoint(xcolumn, ycolumn),4326)<BR>    (see: 
  <A 
  href="http://postgis.refractions.net/documentation/manual-2.0/ST_MakePoint.html" 
  target=_blank>http://postgis.refractions.net/documentation/manual-2.0/ST_MakePoint.html</A>)<BR><BR>Besides 
  that: most likely you want to use ST_DWithin, it's supposed to be faster than 
  ST_Within.<BR><BR>Cheers,<BR> Tom
  <DIV>
  <DIV class=h5><BR><BR>On 8-10-2012 14:40, tasneem dewaswala 
  wrote:<BR></DIV></DIV></DIV>
  <BLOCKQUOTE type="cite">
    <DIV>
    <DIV class=h5>Hello, 
    <DIV><BR></DIV>
    <DIV>I am developing an application to find whether two cars are in each 
    other communication range or not.</DIV>
    <DIV>I have two tables like receiver and transmitter. i would like to know 
    if receiver is in 100 meters range of transmitter or not.</DIV>
    <DIV>Since i am using PostgreSQL first time, i donno much about its 
    functions and commands, but i have found that there is ST_Within(), which 
    can be used for my work. I tried but it gives me lot of errors, probably 
    because of data types of my latitude and longitude. they are in two 
    different columns with datatype as double precision.</DIV>
    <DIV><BR></DIV>
    <DIV>please tell me what is wrong, and how should i use ST_WITHIN for my 
    work. Or tell me any other way of knowing if two objects are in range of 
    each other.</DIV><BR>
    <FIELDSET></FIELDSET> <BR></DIV></DIV>
    <DIV class=im><PRE>_______________________________________________
postgis-users mailing list
<A href="mailto:postgis-users@postgis.refractions.net" target=_blank>postgis-users@postgis.refractions.net</A>
<A href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A>
</PRE></DIV></BLOCKQUOTE><BR></DIV><BR>_______________________________________________<BR>postgis-users 
  mailing list<BR><A 
  href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A><BR><A 
  href="http://postgis.refractions.net/mailman/listinfo/postgis-users" 
  target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR><BR></BLOCKQUOTE></DIV><BR></BODY></HTML>