[mapserver-users] Scale calculation

Ed McNierney ed at topozone.com
Wed Jul 11 15:23:52 EDT 2001


Claude -

The math looks fine.  Do the WIDTH and HEIGHT properties of your IMG tag
(for displaying the map) match the SIZE parameter in your MAP file?  For
example, your template file might have:

<IMG SRC="[img]" WIDTH=400 HEIGHT=400>

and your MAP file include the line

SIZE 600 600

This will cause MapServer to generate a 600x600 pixel image that the
client's browser will squeeze into a 400x400 pixel display.  Depending
on the values involved, the result can look rather "normal" and you
wouldn't see a problem.  But the scale will be wrong because the browser
is resizing the image without MapServer's knowledge.

	- Ed

Ed McNierney
Chief Mapmaker
TopoZone.com
(978) 251-4242

-----Original Message-----
From: Claude Philipona [mailto:claude.philipona at skirando.ch]
Sent: Wednesday, July 11, 2001 4:52 AM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] Scale calculation


I don't quite understand how scale are calculated. I know that mapserver
uses 72
pixel per inch to calculate the scale.

I've a tif raster map where 1 pixel = 2.5 meter. Here is the tfw file:
2.500
0.
0.
-2.500
558751.250
121998.750

I want to calculate the right scale to render 1 pixel in the original
tif file
will give 1 pixel in the mpaserver map (no resizing)

-> size of 1 pixel on screen = 1/72 inch =  2.54/72 cm = 0.0352777777 cm
(based
on constant used by mapserver, I don't care about the real size on the
screen)

-> size of 1 pixel on tif raster map = 2.5 m = 250 cm

-> scale calculation to render one pixel from the raster map to one
pixel to
mapservermap:
0.035277777 : 250 -> 1:7086.6

If I used this setting MINSACLE 7086 in .map file, I don't get the one
to one
pixel ratio and the original map is resized by mapserver.

I've tried to empiracally set the scale and I found a scale of about
5300, which
would mean that the constant used by Mapserver is about 53.85 pixel per
inch.

Even the behaviour of this scale factor is strange, the scalebar is
perfectly
rendered (size of the scalebar corresponds to the size of the features
on the
map)

What is wrong? Do you have any idea?

Claude Philipona




More information about the mapserver-users mailing list