We have developed a set of map/reduce processing scripts that run in Hadoop to consume our Internet address censuses and output hitlists. (This scripts depend on our internal Hadoop configuration and so will require some modification to work elsewhere, but we make them available and encourage feedback about their use.)
For geolocation IP address maps we needed to convert (lon, lat) to color in HSL and RGB color schemes. These two small Perl lonlat2color and python lonlat2color scripts include functions we used to map world coordinates into HSL color space. If we used this function on all coordinates in the world, we’d end up with this rainbow map of the world.
Our formula is:
given (lon, lat): # measured in degrees, positive is north and east compute (hue, saturation, luminance) as: # hue in degrees, saturation constant at 1, luminance range (0, 1) hue = lon_in_degrees saturation = 1 # not much south of 80 degrees, and invert it so north is negative inverted_cappped_lat = -MAX(-80, lat) # scale over a range that makes the land look distinct LATL = -115 LATH = 80 luminance = (inverted_capped_lat - LATL) / (LATH-LATL)