[OSM-talk] querying the postgis db

Richard Weait richard at weait.com
Wed Jul 27 12:41:53 BST 2011


On Tue, Jul 26, 2011 at 2:09 AM, Kenneth Gonsalves <lawgon at gmail.com> wrote:
> hi,
>
> I know that this sounds a bit of a dumb question:
>
> I have installed osm data in a postgis db, and would like to get a list
> of all localities within a particular city - can anyone give a hint on
> the sql required for this?

Here's a hint. ;-)

Find locality points inside any Toronto polygon (includes Toronto,
Iowa (Ohio, NSW AU, etc)

gis=# select p.name from planet_osm_point p, planet_osm_polygon g
where p.place='locality' AND ST_Within(p.way,g.way) AND
g.name='Toronto';

         name
----------------------
 Birchmount Park
 Wexford Heights
 Clairlea
 Clarks Corners
 Woodbine Gardens
 Steeles
 Parkway East
 Bayview Village
 Lansing
 North York
 Westmount
 St. Phillips
 Rouge Hill
 Rouge Park
 Kennedy Park
 York Height
 Hillcrest Village
 Willowdale
 York
 Richview Gardens
 Pine Point
 Kingsview Village
 Martin Grove Gardens
 Beaumonde Heights
 Highfield
(25 rows)



More information about the talk mailing list