Zooming to match a raster scale

Nick Dabner dabner at OPTUSNET.COM.AU
Mon Apr 25 01:58:17 EDT 2005


Ed,

Thanks for the quick response. Followed your workings and got what is a 
near perfect match for another scale. In doing so, I can see how is 
resolution is used, which was some explanation I hadn't found detailed 
elsewhere. Kept it at 72 dpi.

Yes, preview is slow, but the results are nice. Gdalwarp changes 
projections if I am not mistaken. Do you mean gdal_translate to create 
the raster pyramids? Will have to give this a try later today as my 
rasters do vary, especially with inner-city areas. It loooks like I 
would supply the output size in pixels (x,y) to get the the desired 
scale.

Definately info like this is helpful for us non-geo-versed. Need this 
kind of info in the --verbose docs!

Cheers,

Nick

On 25/04/2005, at 11:55 AM, Ed McNierney wrote:

> Nick -
>  
> I'm not sure what your "unit" is supposed to mean, but I can describe 
> the process for taking the pixel size and finding the right 
> MINSCALE/MAXSCALE values.
>  
> The MINSCALE and MAXSCALE values are the denominators of scale ratios, 
> like 1:10,000 scale.  MINSCALE 10000 means "a minimum scale of 
> 1:10,000", where one meter on the map equals 10,000 meters on the 
> ground.  The problem becomes, "what's one meter on the map"?
>  
> The RESOLUTION statement answers that question.  The default value is 
> 72, meaning that 72 pixels in a MapServer output image are presumed to 
> occupy one inch on the screen.  This is actually unlikely to be an 
> accurate value unless you're running a 20-year-old Macintosh, but it 
> often doesn't matter - it's mostly used for internal calculations.
>  
> So, if 72 pixels are presumed to cover one inch on the screen, and 
> your image has a source resolution of 1.26956817 meters per pixel, 
> then one inch on the screen will show 72 * 1.26956817 meters or 
> 91.40890824 meters of image.  Since 91.40890824 meters equals 
> 3598.7687 inches, this means one inch on the screen shows 3598.7687 
> inches on the ground - a scale ratio of 1:3598.7687
>  
> If you displayed that image at the "scale" of 3598.7687 you should get 
> a pixel-for-pixel replica of your source image.  If you use a 
> different RESOLUTION statement, you need to adjust accordingly.
>  
> For calculating the IMGEXT values, you simply need to make the X 
> extent and Y extent equal the number of (X or Y) pixels in the image 
> times 1.26956817.
> Yes, there are better-quality ways of resampling images, but - as you 
> saw in Preview - they're slow.  MapServer doesn't use them, but you 
> can use various tools (including gdalwarp, from the GDAL distribution) 
> to resample images offline and create "pyramids" of varying 
> resolutions.  This will improve the display quality of your images 
> while keeping the performance fast - at the expense of extra disk 
> space and preprocessing work.
>  
>     - Ed
>
> Ed McNierney
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 3766 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050425/f99ae31a/attachment.bin


More information about the mapserver-users mailing list