|
From: | Ed W |
Subject: | Re: [gpsd-users] location lookup |
Date: | Tue, 27 Mar 2012 18:32:49 +0100 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20120313 Thunderbird/11.0 |
On 20/03/2012 20:01, Yan Seiner wrote:
On Tue, March 20, 2012 12:46 pm, Gary E. Miller wrote:Yo Yan! Just download the flat file from the link I gave you. http://geonames.usgs.gov/domestic/download_data.htm It has lat/lons and place names. Just search the file for the nearest lat/lon and take the associated place name. Place names are tagged by type (city, mountain, etc.) so you can limit your search to just cities.Any suggestions on how to do the search? "nearest" is kind of hard to figure out without doing a radius calc.... I'm not sure how to set up the database and index it so as to minimize the computational effort in finding the nearest point. (Storage is not a problem - I have a hard drive attached. cpu and ram are limited. I have a 260 MHz CPU and 32 MB of ram.)
I've not used it, but for sqlite see: http://www.gaia-gis.it/gaia-sins/ The google keywords are probably "spatial" and your favourite databaseNote that the main shortcut is that whilst exact (straight line) distance requires a circular search, you can of course bound that by the square which contains the circle - all databases can optimise straight lookups on x<lat<y and a<lon<b, so you can get pretty close quite easily. Quite possibly close enough for your purposes...
Good luck Ed W
[Prev in Thread] | Current Thread | [Next in Thread] |