[Tilecache] extents, resolutions, etc

Gregor Mosheh gregor at hostgis.com
Wed Apr 16 19:10:21 EDT 2008


alim karim wrote:
> i have just started experimenting with tilecache. can someone please 
> give me a quick walk through the relationships between extents, 
> resolutions and zoom levels?

Resolution: The width or height, in map units, per pixel. For example: 
100 miles wide divided by 256 pixels is a resolution of 0.390625 miles 
per pixel

The maxResolution defines the resolution of the map when zoomed all the 
way out, e.g. the resolution of the "entire world" as far as the map is 
concerned.

The extent, as you know, is the bounding box. Some arithmetic yields the 
resolutions: width in map units, or height in map units, whichever is 
bigger, divided by some number of pixels. e.g.
   Extent extent using latlon: -100 30 -80 45
      width is 20 map units
      height is 15 map units
   We want the entire map to fit into a 512x512 area (a tile is 256 by 
default). So we take the larger number of map units (20) and divide by 
the desired size in pixels (512) and get a maxResolution of 0.0390625

Simple, huh? Take the extent of your map and divide by how big you want 
it to be.


Then each zoom level halves the resolution, fitting the same spatial 
region into a pixel area twice as high and twice as wide as the one 
before it. So your resolution list would look something like this:
   0.0390625
   0.01953125
   0.009765625
   0.0048828125
   ...and so on
But for starters you'll just define X zoom levels and not get into 
manually defining a list of resolutions like this.


Does that clarify a bit, or make it worse? :)

-- 
Gregor Mosheh / Greg Allensworth, BS, A+
System Administrator
HostGIS cartographic development & hosting services
http://www.HostGIS.com/

"Remember that no one cares if you can back up,
  only if you can restore." - AMANDA



More information about the Tilecache mailing list