[mapserver-users] Scale Bar Size Issue

Steve Lime Steve.Lime at dnr.state.mn.us
Mon Sep 28 13:42:30 EDT 2009


When you set a size for a scalebar the width you provide is what you get back. The height is for
the bar only. This was done so that scalebar images could retain the same image size and you 
could just swap img.src in a web app (assuming you're not mucking with font sizes). You'll likely
have to experiment a bit with the width then to get it roughly the right size (e.g ask for 750).

Steve

>>> On 9/24/2009 at 11:04 PM, in message
<1253851467382-3710334.post at n2.nabble.com>, PatB <pbarnhart at gis-services.com>
wrote:

> Hi,
> 
> I'm using the code below to request a scalebar from mapserver.  My
> understanding of the documentation is that the size parameter sets the size
> of the scalebar itself not including the text, border, etc but that's not
> what I'm getting back.  The url below returns an image that is 600 x 153
> (I'm requesting 600 x 75) when it should be more like 750 x 153 to account
> for the surrounding stuff.  The height works as expected and the
> units/distances look right, the width of the scalebar itself is the issue.
> 
> This is for a print app, the output res is 300dpi so by setting the width to
> 600 I was hoping to print a 2 inch wide scale bar with four 1/2" intervals. 
> This seems like it would be a common task but I've been digging though the
> forum for hours without success.  A little help?  I'm using MS version 5.4.2
> 
> mapserv.exe?MAP=C:/ms4w/tmp/maps/mp.map&mode=scalebar&mapext=-8798233+4184184+-8
> 793280+4188502&mapsize=11700+10200&map.scalebar=units+feet+size+600+75+interval
> s+4+label+size+40+end
> 
> and my map file goes something like:
> 
> MAP
> ...
> UNITS meters
> ...
> SCALEBAR
>   STYLE 0
>   IMAGECOLOR 255 255 255
>   LABEL
>     TYPE TRUETYPE
>     FONT "tahoma"
>     SIZE 40
>     COLOR 0 114 255
>   END
>   SIZE 600 75
>   COLOR 235 235 235
>   BACKGROUNDCOLOR 0 114 255
>   OUTLINECOLOR 0 0 0
>   UNITS meters
>   INTERVALS 4
>   STATUS on
>   TRANSPARENT on
> END
> ...
> 
> Thanks - and yes, the map size is friggin huge.



More information about the mapserver-users mailing list