[mapserver-users] Scale Bar Size Issue

Steve Lime Steve.Lime at dnr.state.mn.us
Mon Sep 28 16:43:23 EDT 2009


No, the image size is held constant and changes in the bar itself are made to accommodate for
that restriction, at least that what we try to do. We know how much space we have for the 
bar and the various text elements and work backwards from that. You say, if the bar is
so big the text is this, does it fit? If not then make the bar a touch shorter and re-compute 
things. Again, that  was done to  facilitate websites where just image elements change and 
not printing.

I suppose one could hack the scalebar code to interpret the size to mean "the bar" and not
the image, or at least have that as an option. I'll take a peek and get back to you (or feel free
if you're so inclined). Probably easier to hack the source than make your own.

Steve

>>> On 9/28/2009 at 2:12 PM, in message <1254165139306-3731312.post at n2.nabble.com>,
PatB <pbarnhart at gis-services.com> wrote:

> The image size will vary because of the length of the last callout under the
> bar, right?  100000 km will stick out past the bar farther than 5000 m.  I
> guess I could eyeball how much based on the font size, number of characters
> and ouput dpi but, well, bleach.  Is there a better way?  Plan B is to make
> my own scalebar but I'm not wild about that idea either.
> 
> Engineers all over the world just cringed when I wrote 'eyeball'.
> 
> Thanks.
> 
> 
> Steve Lime wrote:
>> 
>> 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.
>> 
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org 
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users 
>> 
>> 



More information about the mapserver-users mailing list