Quadkey Notation
The quadkey notation is not as intuitive to grasp as the x, y, and z notation, but it exists and has some advantages; both Microsoft's Virtual Earth and Google's satellite map type use a quadkey to identify single tiles. The number of digits in a quad key is equal to the zoom level and the x and y coordinates are encoded as 0, 1, 2, or 3 for Microsoft's Virtual Earth and as q, r, s, or t for Google's satellite maps. Table 1 shows the quadkeys for the four tiles at zoom level 1.
To get a feeling of how the quadkey encoding works, take a look at this notation that zooms in on New York City. The ultimate ancestor tile for all four tiles in New York City would be the upper left tile in Table 1 (with the quadkey of 0). New York City is somewhere in the lower right of that parent. The lower right has a quadkey of 3. Thus, New York City has a quadkey of 03 at zoom level 2. Table 2 shows how to recursively apply the quadkey definition at increasing levels of zoom.
|

quadkey=03 or qs zoom=2
|

quadkey=032 or qst zoom=3
|
|

quadkey=0320 or qstq zoom=4
|

quadkey=03201 or qstqr zoom=5
|
You can also gain a good understanding of how the quadkey notation works by zooming out starting from the following URL and gradually removing digits, one at a time, starting from the end of the quadkey:
http://r0.ortho.tiles.virtualearth.net/tiles/r0320101101320123.png?g=01
Also, try the Google satellite tile given by the following URL where qstqrqrrqrstqrts is equivalent to 0320101101320123:
http://kh0.google.com/kh?n=404&v=23&t=tqstqrqrrqrstqrts
Besides containing the property the length of which quadkey equals the zoom level, the quadkey contains it's parent tile's quadkey. Nearby tiles usually have similar quadkeys too. These properties can be leveraged using the tile server to cluster and optimize tile storage and retrieval.
The Mercator Projection
When a client requests a tile by location and zoom, most tile servers respond with a tile from the Mercator projection. This is the standard map view of the world where longitude lines are vertical and latitude lines are always horizontal (used in Google Maps, and so on). One result of this view is that you can never see the north or south poles. The boundaries of the map, shown in Table 1, are 85 degrees north, 180 degrees west to -85 degrees south, 180 degrees west. While the 85 degree cutoff appears to be arbitrary, it is actually the point where, mathematically, the Mercator projection becomes a perfect square.
The tiles presented to the client are just smaller squares taken from the larger, square Mercator projection. The upper left tile is referenced by x = y = 0 and is bounded by 85 degrees north and 180 degrees west. The lower right tile is referenced by x = y = 2z - 1, where z is the zoom level, and is bounded by 85 degrees south and 180 degrees east. At any one time, your client simply displays a subset of tiles, which are then translated to screen coordinates.
| Home / Articles
/ Deliver On-the-Fly Mapping Services to Your Rich Desktop Java Application, Part 1 / 1 / 2 / |
Next Page
|
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|