View Single Post
  #5  
Old March 3rd 06, 08:23 PM posted to rec.aviation.simulators
external usenet poster
 
Posts: n/a
Default Lat/Lon to country codes/political boundaries



Peter Duniho wrote:
"Jeroen Wenting" jwenting at hornet dot demon dot nl wrote in message
...

You'd need a fairly large database of coordinates to determine that.



Not really.


Basically what I'd do is generate a fairly dense grid of cells overlaid on
a world map which lists the countries for each cell and store that in a
database.



Typically, what a program would actually do is store the boundary data as
vectors. Some optimization might be done to narrow the initial search
(perhaps grouping them within each octant of the sphere, for example), but
ultimately all one needs to do is a "point in polygon" test on each country
in the database, using the boundary data.

The boundary data can be as detailed as one wants. Searches go faster with
less detail, but of course that opens the possibility for boundary cases
returning the wrong country. IMHO, there's no practical way to solve that
though, given the inherent errors in the basic data anyway. Except for
boundaries defined by straight lines, no matter how much resolution you
have, there's the possibility for a wrong answer. The main thing is to make
sure the user is aware of the possibility (and to reduce the error enough
that a wrong answer isn't a big deal).

Using vector data is MUCH more efficient than turning the entire world into
a bitmap. Even though the algorithm is more complex, the sheer data
bandwidth issues for a world-sized bitmap more than offsets that.

Pete



Now there is a familiar name! Ditto from the rec.av.piloting newsgroup!
It's been some moons, Peter, although I see that you continue to do
favorable nod justice to the 'scribbler' dictums of Messrs. Strunk and
White! Relax, Peter, that's an on-going compliment!

Anyway, after some time away from both the real McCoy and flight simming
for reasons I won't bore you with, I've returned to the flight deck, so
to speak. Peter, and recalling some of the more humorous times in
rec.av.piloting [RAP], do you recall a poster named Al Smith? Not a nym,
mind you, but if you should see his moniker, please tell him that Doc
was asking for him and says hello! Like yourself, real McCoy stuff [SEL
and helo too] ... and the sims. So too, and while you're here, I added
the CH USB throttle quadrant to the CH USB yoke [I like those
'instructions' [!?] that came with it ... essentially .... 'you', the
user, figure it out and give us a call if there is a problem!] ---
anyway --- more than once, literally, I program the thing for FS2K2 and
FS9 only to come back to it upon machine restart .... and the
programming is gone! Am I missing something? Further, and perhaps this
is unique only to myself [translation: op error in re not knowing how to
use it properly!], I find the quadrant is 'very', how shall I say,
sensitive to sensitivity settings, so what's your take, if you use the
quadrant yourself of course, on a sort of compromise quadrant
sensitivity and null area setting(s)? And do you advise the simple or
advanced settings for best results?

Thanks, Peter.


Doc Tony