# [ka-Map-users] Calculating number of tiles in cache

Shoaib Burq hydromap at gmail.com
Fri Feb 3 07:30:26 EST 2006

```Thanks heaps Paul

I was having trouble with converting geographic extents to pixels for
a given scale
Then realized the scale is worked out in inches...
so now i'm doing this:

CellSize @ given scale = Scale/(image resolution * inches-per-mapUnit)
PixelExtents = (GeoExtents * inches-per-mapUnit)/CellsSize
Num-of-Tiles = PixelExtents/TileSize
Total Tiles = Num-of-Tiles * Num-of-Tiles  ... (assuming square tiles)

look right to you?
cheers
shoaib

>
> the maximum size of the tile cache for a given kaMap installation
> could be calculated from:
>
> total = 0
> for each map file
> {
>      for each scale
>      {
>          for each separate group in the map file
>          {
>               convert geographic extents to pixels at this scale
>               divide width and height by tile width and height
>               multiple number of tiles wide by high
>          }
>      }
> }
>
> Tile size on disk depends on output format generally, and also on
> image complexity in compressed formats like PNG.  You'll probably
> need to do a random sampling at each scale to get a good average
>
> Cheers
>
> Paul
>
> On 2-Feb-06, at 7:47 AM, Shoaib Burq wrote:
>
> > Hi
> >
> > I am trying to estimate the potential size of ka-map cache.
> >
> > Not so sure about the math to calculate the number of tiles given:
> >
> > 1. Area of the region
> > 2. Raster Resolution
> > 3. Tile Size
> > 4. Num of Layers
> >
> > any suggestions?
> >
> > Also what's a good way to estimate the size of each tile on disk?
> >
> > thanks heaps
> > shoaib
> >
> > _______________________________________________
> > ka-Map-users mailing list
> > ka-Map-users at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/ka-map-users
> >
>
> +-----------------------------------------------------------------+
> |Paul Spencer                           pspencer at dmsolutions.ca   |
> +-----------------------------------------------------------------+
> |Applications & Software Development                              |
> |DM Solutions Group Inc                 http://www.dmsolutions.ca/|
> +-----------------------------------------------------------------+
>
>
>
>
>

```