Read first chapter of our book (which is a free download). The examples at the end covers exactly what you are asking. http://www.manning.com/obe/ Also if you don't know much about SQL, the free Appendix C covers the fundamentals of SQL. Leo http://www.postgis.us
_____ From: postgis-users-boun...@postgis.refractions.net [mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of tasneem dewaswala Sent: Tuesday, October 09, 2012 1:22 AM To: PostGIS Users Discussion Subject: Re: [postgis-users] finding whether an object lies in vicinity of another object Hello, Thank you for your reply. I have added a geometry column to my existing table. But i am facing problems in updating that column. since i have thousands of row, it would not be feasible to update each row at a time. what should i do to update all geometries at once? On Mon, Oct 8, 2012 at 6:32 PM, Tom van Tilburg <tom.van.tilb...@gmail.com> wrote: Hi Tasneem, 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). I would recommend to do some reading in the manual, especially here: http://postgis.refractions.net/documentation/manual-2.0/PostGIS_FAQ.html#id6 05751 It boils down to adding a column with SELECT AddGeometryColumn('', 'yourtable','geom',-1,'POINT',2); and then filling the column with UPDATE yourtable SET geom = ST_SetSrid(ST_MakePoint(xcolumn, ycolumn),4326) (see: http://postgis.refractions.net/documentation/manual-2.0/ST_MakePoint.html) Besides that: most likely you want to use ST_DWithin, it's supposed to be faster than ST_Within. Cheers, Tom On 8-10-2012 14:40, tasneem dewaswala wrote: Hello, I am developing an application to find whether two cars are in each other communication range or not. I have two tables like receiver and transmitter. i would like to know if receiver is in 100 meters range of transmitter or not. 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. 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. _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users