[mapserver-users] Scalebar (and C# mapscript) issue
Murty Maganti
MMaganti at oriongis.com
Tue Feb 17 09:29:29 PST 2009
Hi Brian
I had verified my code and there is no issue setting the units correctly
in C#. In fact, I see the same issue setting the units to feet in map
file directly. It seems there is some rounding issue when the scale
values are too large. Please see the ticket
http://trac.osgeo.org/mapserver/ticket/2890.
Thanks a lot for your response.
Murty
From: Hulbert, Brian [mailto:brian.hulbert at linquest.com]
Sent: Tuesday, February 17, 2009 11:13 AM
To: Murty Maganti; mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] Scalebar (and C# mapscript) issue
Murty,
It works fine for me using MapServer 5.0.2 with an equirectangular
projection using a WGS84 geoid reference whether I'm zoomed to a world
view or to a street-level view. Be sure you are setting the scalebar
units member accordingly in C#. For example, scalebar.units =
(int)OSGeo.MapServer.MS_UNITS.MS_FEET to set the units to feet.
However, I have noted that it will appear garbled and squashed in width
if you use units which are not meaningful for the current zoomed area.
In other words, don't use inches when zoomed to a city or world
view...the numbers are too large to display properly. Write a routine
that sets the appropriate units based on the delta degrees that you are
showing. For example, if the user chose English units (versus metric)
and the current viewport spans roughly ~0.5 nautical miles, then set the
units to inches. If the viewport is > 0.5 NM and < 1 NM, set the units
to feet. Otherwise (the viewport spans more than 1 NM), set the units
to miles. You can tweak this idea to suit your needs but this works
well for me.
Brian
NOTE: The views expressed are the author's and do not necessarily
reflect the official position of LinQuest Corporation or any of its
subsidiaries or the organization providing Internet access.
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Murty
Maganti
Sent: Friday, February 13, 2009 2:20 PM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Scalebar (and C# mapscript) issue
Hello
I am having strange issue with scalebar. I have scalebar displayed on
map (embed) and scale units are set to miles. It has size of 200x10
pixels. It shows up fine on the map. Then at run time (using C# map
script), I just change the units to feet or meters and the bar size
shrinks (to almost 10 pixels length), which appears strange to me. Why
would the scalebar length changes by changing units. Is there any other
setting I need to set to maintain the same scalebar size?
This works fine (or not noticeable) for maps which have extents at city
level. I am testing on map which displays Ontario province (Canada).
Also, you need to have projection elements defined at both map and layer
level. In my case, the projection is same (WGS 1984).
Thanks
Murty
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090217/7e289efb/attachment.htm>
More information about the MapServer-users
mailing list