[mapserver-users] Raster Strategies Examples

Frank Warmerdam warmerdam at pobox.com
Tue Aug 3 08:12:51 EDT 2010


Folks,

I'm sorry for speaking up on this without having read the other replies.
Forgive me for repeating information.

Edi.Karadumi wrote:
> as you may know, i have very slow performance when i zoom out and im stucked
> here. As i have read i should make a copy of the tiles with reduced
> resolution. Merge the tiles together and use min/max scale to show different
> layers in different scales. the min/max scales i zoom in/out are
> 100/1200000. Now my questions are
> 
> - How can i calculate the scale where i should create another layer of the
> tiles, or i shoud see it with some tests?

I find the MapServer scale values very confusing myself.  If I want
to compute the scale for particular request (for instance to establish
breakpoints for MINSCALE/MAXSCALE), I do a request at the target resolution
with shp2img and debug output on and examine the debug output for the scale
reported.

> - how much should be the resolution of the new layer? 

You basically want to move to a new mosaiced overview layer at the point
where a map request is likely to request several tiles at once.  If
we, roughly, assume a map request is on the order of 500x500 then at
32 times reduction in resolution would give a request over an area of
16000 x 16000 which is certain to touch several of your 6000 x 6000
base files.  So, I'd aim to have this merged mosaic at approximately
1/32nd of the resolution of the original imagery.

1200GB of full res imagery reduced to 1/32nd resolution is only about 1GB
so it is a very managable size for an overview layer.

> - is there any tools or program to merge the tiles? merging 6000 tiles with
> the gdalwarp by writing the command by myself is frustrating

gdalwarp can take multiple input files in one run, but there are
some issues with how gdalwarp is implemented that make it not scale
well to many input files without great care.  Since the input files
are quite a modest size I would suggest using gdal_merge.py to
mosaic them at a reduced resolution.  If your original imagery were
5m pixels something like:

gdal_merge.py -o overview_mosaic.tif -ps 160 160 */*.tif

might do the trick.

> - how many tiles should i merge together to create the new layer? (how many
> tiles should have the new layer) i know that in each zoomscale its better to
> appear only one tile but i dont know how to calculate it
> 
> - the tiles that i should merge are the originals or those with internal
> tiling and overviews?

If you use gdal_merge.py, it is best to use input files that have overviews
already built.  This will ensure that the mosaic built uses the same
downsampling technique (ie. averaging) that you used to build the overviews.
It will also make the mosaicing much faster.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list