<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">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 class="moz-txt-link-freetext" href="http://postgis.refractions.net/documentation/manual-2.0/PostGIS_FAQ.html#id605751">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 class="programlisting"> 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 class="moz-txt-link-freetext" href="http://postgis.refractions.net/documentation/manual-2.0/ST_MakePoint.html">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<br>
<br>
On 8-10-2012 14:40, tasneem dewaswala wrote:<br>
</div>
<blockquote
cite="mid:CADmqzs3gCebgP68eCuenAPDZ-zy30=Re2hGHnUqcJLbZ4_xAbQ@mail.gmail.com"
type="cite">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 class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
</pre>
</blockquote>
<br>
</body>
</html>