Hi,
i have database file with lattitude,longitude and place name in spi based flash memory,and my contoller is interfaced with GPS receiver with pumps NMEA strings .from string i am taking lattitude and longitude .present lattitude and longitude values must be serched in flash memory.if the values match in flash memory place name should be displayed. i need best serching algorthims.
if anybody have any idea how to search .please reply me
tahns®ards
HI,
My flash has 32 sectors each contain 256 pages, so totally i have 8192 pages.for example +17.2345(lat),+078.345(Long),Delhi*,i wiil be going to write in to flash.like this for whole india i have store in the flash memory.lat and long will be in ascending order.
One mechanism I had used earlier was to store data based on the road lines (for Car navigation system)in Bangalore ... So searching was very easy on straight line. On intersections I would wait till I had better data.
1) You need to realize that you aren't going to be able to match the coordinates directly by comparison, unless you reduce the resolution of the data. Just chopping off digits isn't really very good because you could end up being quite far off. You probably want to know the distance between the points and then choose one that is less than some threshold. 1km, 100m, etc. (this will depend on your application)
2) Further to the "knowing the distance" problem... when you calculate distance on the earth, you must use a formula which takes the curvature into account. This is typically called "great circle distance" and is the shortest path between two points on the earth. Transcontinental airplane flight routes are often figured out this way.
I found this page which you might find helpful. It contains the formulas you need. Not surprisingly you need a little bit of trig. but even a small CPU should be able to do this without much effort.