[postgis-users] finding whether an object lies in vicinity of another object
tasneem dewaswala
tasneem.europe at gmail.com
Mon Oct 8 22:22:17 PDT 2012
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.tilburg at 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#id605751
>
> 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 listpostgis-users at postgis.refractions.nethttp://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121009/ae2ca8d2/attachment.html>
More information about the postgis-users
mailing list