[ka-Map-users] Calculating number of tiles in cache
Adair, Mike
Mike.Adair at CCRS.NRCan.gc.ca
Fri Feb 3 10:31:05 EST 2006
Paul, Shoaib,
Maybe this will help? From Mapbuilder, lib/tool/Extent.js:
var Rearth = 6378137.0; // Radius of the earth (sphere);
different from Proj value?
var degToMeter = Rearth*2*Math.PI/360;
var mbScaleFactor = 3571.428 //magic number, for Geoserver SLD
compatibility
// 1/0.00028 (0.28 mm "is a common actual
size for
// contemporary display" as written in the
SLD specification ...
/**
* Returns the map scale denominator for the current extent resolution
* @return map scale denominator
*/
this.getScale = function() {
var pixRes = null;
switch(this.model.getSRS()) {
case "EPSG:4326": //all projection codes in
degrees
case "EPSG:4269":
pixRes = this.res[0]*degToMeter;
break;
default: //all projection codes in meters
pixRes = this.res[0];
break;
}
return mbScaleFactor*pixRes;
}
Where this.res[0] is the pixel resolution in meters.
Mike
> -----Original Message-----
> From: ka-map-users-bounces at lists.maptools.org
> [mailto:ka-map-users-bounces at lists.maptools.org] On Behalf Of
> Paul Spencer
> Sent: February 3, 2006 10:18 AM
> To: Shoaib Burq
> Cc: ka-Map-users at lists.maptools.org
> Subject: Re: [ka-Map-users] Calculating number of tiles in cache
>
> Shoaib,
>
> scale is actually 'unitless' :) The calculations look
> correct but I honestly haven't put a lot of time into it. It
> would be very cool if someone wrote a script to do this
> calculation ... I would hope it would read the config file
> and get the map files and scales from there and tell you the
> potential ka-cache size in tiles :)
>
> Cheers
>
> Paul
>
> On 3-Feb-06, at 7:30 AM, Shoaib Burq wrote:
>
> > 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
> >> add to total
> >> }
> >> }
> >> }
> >>
> >> 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/|
> >> +-----------------------------------------------------------------+
> >>
> >>
> >>
> >>
> >>
> >
> > _______________________________________________
> > 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/|
> +-----------------------------------------------------------------+
>
>
>
>
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users
>
More information about the ka-Map-users
mailing list