Zooming to match a raster scale

Ed McNierney ed at TOPOZONE.COM
Mon Apr 25 06:15:20 PDT 2005


Nick -
 
Gdalwarp "warps" an image from one representation to another.  That can
be a change in projection, or a change in spatial resolution, or both
(or neither, I suppose <g>).  I wasn't specifically talking about
creating pyramids, although that is another option you should
investigate.
 
     - Ed
 
Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242 


________________________________

From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Nick Dabner
Sent: Monday, April 25, 2005 1:58 AM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] Zooming to match a raster scale


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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050425/c1e88832/attachment.htm>


More information about the MapServer-users mailing list