[mapserver-dev] mapcache file structure

Eichner, Andreas - SID-NLKM Andreas.Eichner at sid.sachsen.de
Mon Jul 2 23:52:26 PDT 2012


Hello Stephen,

you basically need the following components to do this job

start of the bbox within the grid:
  tile.x = floor((bbox.minx - grid.minx) / resolution[level] / tile.width)
  tile.y = floor((bbox.miny - grid.miny) / resolution[level] / tile.height)

size of the bbox in tiles:
  width = ceil((bbox.maxx - grid.minx) / resolution[level] / tile.width) -
          floor((bbox.minx - grid.minx) / resolution[level] / tile.width)
  height = ceil((bbox.maxy - grid.miny) / resolution[level] / tile.height) -
           floor((bbox.miny - grid.miny) / resolution[level] / tile.height)

split tile indizes into parts of thousands (for the hashed filesystem structure):
  X_high = tile.x / 1000000
  X_mid  = (tile.x / 1000) % 1000
  X_low  = tile.x % 1000
  Y_high = tile.y / 1000000)
  Y_mid  = (tile.y / 1000) % 1000
  Y_low  = tile.y % 1000

then you can concatenate it to build the filename:
  ${base} / ${tileset} / ${level} / ${X_high} / ${X_mid} / ${X_low} / ${Y_high} / ${Y_mid} / ${Y_low}.${ext}

HTH

> -----Ursprüngliche Nachricht-----
> Von: mapserver-dev-bounces at lists.osgeo.org 
> [mailto:mapserver-dev-bounces at lists.osgeo.org] Im Auftrag von 
> Stephen Woodbridge
> Gesendet: Dienstag, 3. Juli 2012 02:35
> An: mapserver-dev
> Betreff: [mapserver-dev] mapcache file structure
> 
> Hi Thomas,
> 
> In need to extract all the tiles for a given bbox for all 
> zoom factors, 
> My plan is to do this in a Perl script. In addition I might 
> to need to 
> change the directory structure and file names to fit an 
> existing cache.
> 
> Do you have any documentation on the file structure and how 
> it relates 
> to coordinates in various projections?
> 
> Thanks,
>    -Steve W
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
> 


More information about the mapserver-dev mailing list