anchor.diff:      SpatialEnclosure = global_grid:get_img_coordinates_enclosure(RasterInfo),
       TileEnclosure = global_grid:calc_tminmax(ProfileMod, SpatialEnclosure, Tmaxz),
       {Tmaxz, TileEnclosure}.
  -
  -
  -%% =============================================================================
  -%% private functions
  -%% =============================================================================
   
   %% @doc Get the minimal and maximal zoom level
   %% minimal zoom level: map covers area equivalent to one tile
  
positive.code: 
  -include("global_grid.hrl").
  
  %% API
  -export([
           calc_tiles_enclosure/0,
           copyout_tile_for/3
          ]).
  
  -spec copyout_tile_for(integer(), integer(), byte()) -> 
      {ok, reference()} | {error, string()}.
  
negative.code:     gdal_nif:copyout_tile(RasterImg, Rb, Wb).
  
  
  %% =============================================================================
  %% private functions
  %% =============================================================================
  
  %% @doc Continuation
  scan_img(#tile_position{current_tile_x = MaxX,
                          current_tile_y = MaxY,
                          tile_zoom      = _TileZoom,
                          tile_enclosure = {_,_, MaxX,MaxY}}) ->
      done;
  scan_img(#tile_position{current_tile_x = MaxX,
                          current_tile_y = Y,
                          tile_zoom      = TileZoom,
                          tile_enclosure ={MinX,MinY,MaxX,MaxY}}) ->
      {continue, {MinX, Y + 1, TileZoom},
                  fun() ->
                      scan_img(
                               #tile_position{current_tile_x = MinX,
                                              current_tile_y = Y + 1,
                                              tile_zoom      = TileZoom,
                                              tile_enclosure = {MinX,MinY,MaxX,MaxY}})
                  end};
  scan_img(#tile_position{current_tile_x = X,
                          current_tile_y = Y,
                          tile_zoom      = TileZoom,
                          tile_enclosure={MinX,MinY,MaxX,MaxY}}) ->
      {continue, {X + 1, Y, TileZoom},
                  fun() ->
                      scan_img(
                               #tile_position{current_tile_x = X + 1,
                                              current_tile_y = Y,
                                              tile_zoom      = TileZoom,
                                              tile_enclosure = {MinX,MinY, MaxX, MaxY}})
                  end}.
  
  
  %% @doc calculate the tiles enclosure of the img Raster in a specified zoom level
  %% the zoom level is dicided by the img precision which is defined in RasterInfo
  %% and used for base_tiles of the img
  