[postgis-users] point-in-poly query

John.C.Cartwright at noaa.gov John.C.Cartwright at noaa.gov
Tue Jan 17 21:03:35 PST 2006


Hello,

given a table of country polygons and a table of city points, I'm trying
to find all the cities that fall w/in a given country.  The query listed
below runs slowly and also produces incorrect results.  Can someone
correct what I'm doing wrong?

select cities.city_name,cities.cntry_name
from cities p, country a 
where p.shape && a.shape and 
  intersects(p.shape,a.shape) and 
  a.gmi_cntry = 'USA';   



Thanks!

-- john




More information about the postgis-users mailing list