Package mapproxy :: Package core :: Module grid
[hide private]
[frames] | no frames]

Module grid

source code

(Meta-)Tile grids (data and calculations).
Classes [hide private]
  NoTiles
  TileGrid
This class represents a regular tile grid.
  MetaGrid
This class contains methods to calculate bbox, etc.
Functions [hide private]
float
get_resolution(bbox, size)
Calculate the highest resolution needed to draw the bbox into an image with given size.
source code
 
tile_grid_for_epsg(epsg, bbox=None, tile_size=(256, 256), res=None)
Create a tile grid that matches the given epsg code:
source code
 
_create_tile_list(xs, ys, level, grid_size)
Returns an iterator tile_coords for the given tile ranges (xs and ys).
source code
 
is_float(x) source code
 
pyramid_res_level(initial_res, factor=2.0, levels=20)
Return resolutions of an image pyramid.
source code
 
bbox_intersects(one, two) source code
 
bbox_contains(one, two) source code
Variables [hide private]
  log = logging.getLogger(__name__)
  geodetic_epsg_codes = [4326]
  RES_TYPE_SQRT2 = 'sqrt2'
  RES_TYPE_GLOBAL = 'global'
  RES_TYPE_CUSTOM = 'custom'
Function Details [hide private]

get_resolution(bbox, size)

source code 

Calculate the highest resolution needed to draw the bbox into an image with given size.

>>> get_resolution((-180,-90,180,90), (256, 256))
0.703125
Returns: float
the resolution

tile_grid_for_epsg(epsg, bbox=None, tile_size=(256, 256), res=None)

source code 
Create a tile grid that matches the given epsg code:
Parameters:
  • epsg ('EPSG:0000', '0000' or 0000) - the epsg code
  • bbox - the bbox of the grid
  • tile_size - the size of each tile
  • res - a list with all resolutions

_create_tile_list(xs, ys, level, grid_size)

source code 
Returns an iterator tile_coords for the given tile ranges (xs and ys). If the one tile_coord is negative or out of the grid_size bound, the coord is None.

pyramid_res_level(initial_res, factor=2.0, levels=20)

source code 

Return resolutions of an image pyramid.

>>> pyramid_res_level(10000, levels=5)
[10000.0, 5000.0, 2500.0, 1250.0, 625.0]
>>> pyramid_res_level(10000, factor=1/0.75, levels=5)
[10000.0, 7500.0, 5625.0, 4218.7500000000009, 3164.0625000000005]
Parameters:
  • initial_res - the resolution of the top level (0)
  • factor - the factor between each level, for tms access 2
  • levels - number of resolutions to generate