[prev in list] [next in list] [prev in thread] [next in thread]
List: postgis-users
Subject: Re: [postgis-users] Query all places within a given distance around
From: Per-Olof_Norén <pelle () alma ! nu>
Date: 2007-12-20 7:02:30
Message-ID: 476A1386.4080301 () alma ! nu
[Download RAW message or body]
Hi,
Sebastien ARBOGAST skrev:
> It's the first time I play with a GIS database,
> and I need to perform some simple query. I could probably figure it
> out myself but the amount of documentation, specifications and
> standards to read is really frightening. So maybe someone can help me
> here.
>
> In my PostGIS database, I have a 'place' table whose
> 'location' column is a geometry (corresponding to a point).
> The inputs of my query are:
> - a reference POINT(lat,lon,alt) ref
> - a distance d
>
> Now I would like to write a query to find all the PLACE's
> whose location loc is such that the geodetic distance between ref and
> loc is less than a given distance d.
>
> How would I write such a query?
>
>
Assuming you've read the docs:
http://postgis.refractions.net/docs/ch06.html
Something along the lines described below should work (havent tested myself)
select *
from place
where ST_distance_sphere(location, ST_MakePoint(lat,lon,alt)) < d
I'm quite sure the mail archives of postgis mailinglist has touched this
subject as well.
http://postgis.refractions.net/pipermail/postgis-users/
Cheers,
Per-Olof
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic