Обсуждение: Search by distance
HI,
I would like to implement a search by distance to my application.
Something like (pseudo sql):
select * from users
where users.location is less than 15 miles from chicago.
Any documentation on how to implements that?
I guess I also need a database of the cities coordinates. Where could I find one?
Thanks
Oscar
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.
I would like to implement a search by distance to my application.
Something like (pseudo sql):
select * from users
where users.location is less than 15 miles from chicago.
Any documentation on how to implements that?
I guess I also need a database of the cities coordinates. Where could I find one?
Thanks
Oscar
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.
Oscar Picasso wrote: > HI, > > I would like to implement a search by distance to my application. > > Something like (pseudo sql): > > select * from users > where users.location is less than 15 miles from chicago. > > Any documentation on how to implements that? > > I guess I also need a database of the cities coordinates. Where could > I find one? > > Thanks > > Oscar > > ------------------------------------------------------------------------ I can't help you with the coordinates, but this is exactly what the contrib package PostGIS is designed for. Jeff
Oscar Picasso wrote: > I guess I also need a database of the cities coordinates. Where could > I find one? You can download US data here: http://geonames.usgs.gov/domestic/download_data.htm These are tables of geo entities with a number of columns, including lat/long. NGA (formerly NIMA) has similar data for non-US entities: http://earth-info.nga.mil/gns/html/cntry_files.html Note that these data sets include =lots= of entities, not just cities - we've combined them into a DB with about 6 million items, and only about 2.5 million are population centers (by our scheme). Each of the data sets has feature type columns that you can filter on, though. - John Burger MITRE