Creating natural area codes
The Natural Area Code (NAC) is yet another way to encode geographic position information into a short character string. The whole NAC system can include altitude information along with the surface position. We'll focus on the latitude and longitude conversions for NAC.
See http://www.nacgeo.com/nacsite/documents/nac.asp, for more information
This uses base 30 instead of base 240; we can use most of the alphabets plus some digits to represent a single base 30 digit. This implementation will show a different approach to convert floating-point numbers to an integer approximation. This will combine multiple calculation steps into longer expressions.
NAC uses a 30-character encoding that employs digits and consonants. The string used for encoding and decoding is this:
>>> nac_uppercase= "0123456789BCDFGHJKLMNPQRSTVWXZ" >>> len(nac_uppercase) 30 >>> nac_uppercase[10] 'B' >>> nac_uppercase.find('B') 10
We can take a longitude (-180 to ...