Hypothetical MaemoMapper Basemap Scripts

June 2, 2006 on 12:51 pm | In googlemaps, maemo, nokia770 | 5 Comments

Based on my earlier post about hosting a Google maptile basemap, it is clear to me that i should really avoid posting anything that may be licensed, no matter how good my intentions.

But many expressed interest in the scripts. I won’t post the scripts but will have a discussion on what interesting things i found in tthe process of developing these scripts.

GoogleMap Tiles

Google maps are really just a series of square tiles for 17 zoom levels, arranged in x/y quadrants.

  • zoom=17 / x=0 / y=0 : The whole world
  • zoom=16 / x=0-1 / y=0-1 : The world divided into 4 quadrants with North America at 0,0
  • zoom=15 / x/y=0-3 : The world divided into a 4×4 grid with Alaska at 0,0 (roughly)
  • zoom=14 / x/y=0-7 : should be getting obvious by now…
  • zoom=13 / x/y=0-15
  • zoom=12 / x/y=0-31
  • zoom=11 / x/y=0-63
  • zoom=10 / x/y=0-127
  • zoom=9 / x/y=0-255
  • zoom=8 / x/y=0-511
  • zoom=7 / x/y=0-1023
  • zoom=6 / x/y=0-2047
  • zoom=5 / x/y=0-4095
  • zoom=4 / x/y=0-8191
  • zoom=3 / x/y=0-16383
  • zoom=2 / x/y=0-32767
  • zoom=1 / x/y=0-65535

(and i did all of those numbers in my head….)
Fundamentally each decreasing zoom level subdivides each tile at the level above into 4 quadrant tiles, and so on. So we have 1 tile at 17, 4 tiles at 16 and 2^16 squared (a crapload.. squared) at level 1.

latitude / longitude conversions – redacted (jan 2007) – After reading this many months later, I believe that my ability to communicate the method about the lat/long conversions was flawed and misleading.  I was trying to represent a simplified approach to the Mercator projection that Google uses, but failed. My apologies.

Scale – redacted (jan 2007)

Tile file format – If you take a look at the tile files stored in the MaemoMapper directory, they all have the ‘.jpg’ extension. However, they are not jpg files, they are PNG files. That also happens to be what the GoogleMap tiles are served as, so rest easy, no conversion necessary.

Directory format – MaemoMapper expects the tiles to be organized in a very specific manner. The upper directory name is the zoom level, and the next directory name is the longitude index (xgrid index). Each file is named as the latitude index (ygrid index). These indices correspond to the GoogleMap tile indices, so once again no conversion is necessary.

Monochrome Tiles – After i started getting a few sets of basemaps from the server, i noticed a large number of tiles that were exactly 103 bytes. It turns out that these correspond to featureless monochromatic tiles, like the middle of the ocean. Interestingly, about 73% of the tiles at level 10 were this size. Well i considered this a real waste of file space since each one of these could be interpolated / extrapolated from higher level tiles, and each one used a file sytem block (much larger than 103 bytes). To address this issue, i wrote a script to delete all files from the directories that were less than 104 bytes.

Scripts

I am not going to post the scripts, the GoogleMaps tile URL, or the mapsets. I am just not interested in getting a cease and desist letter. However, I will give you these clues. The prune script is exactly 1 line of 34 characters. The bulk downloader is about 11 lines long of sloppy , trivial code with two loops.

If that isn’t enough for you to write your own, then i feel better about not giving guns to babies.

In closing, i would like to say thank you to Google for creating a resource like GoogleMaps that is so easily accessible for geeks and hackers such as ourselves. I would also like to say, that I respect the ownership of this content by Google, and think that time will tell what color this gray area will turn into eventually. Personally I feel that the Google brand benefits in value and respect by pervasively becoming a resource that is usable by open source community (eg MaemoMapper).

But i am not the final arbitor on this subject, so nuff said.

Disclaimer – I do not endorse or encourage anybody using the above information to aquire, absond, steal licensed intellectual property. I simply found out some information that I thought was uber-interesting enough to share.

License – I am placing all content of this blog posting under the creative commons license (http://creativecommons.org/)

ubergEEk

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^