[mapserver-users] mapserver scalebar

Lars Lingner gislars+list at googlemail.com
Fri Sep 16 06:41:38 EDT 2011


Hello,

I have an issue with the mapserver scalebar. Hopefully it is just my
understanding thats wrong.

My data is epsg:4326 which is also used for displaying the map requested
via wms.

When I embed a scalebar, the length of it isn't correct. It show an
value about as twice (200+ meter) the right value (~120 m).
The region I'm displaying is in northern europe about 55.8 latitude.

My mapfile looks like this:

MAP
 ...
 UNITS METERS
 EXTENT ....
 ...
 PROJECTION
   "init=epsg:4326"
 END
 SCALEBAR
    IMAGECOLOR 255 255 255
    LABEL
      COLOR 0 0 0
      SIZE SMALL
    END
    STYLE 1
    SIZE 100 3
    COLOR 0 0 0
    UNITS METERS
    INTERVALS 2
    POSITION lc
    TRANSPARENT TRUE
    STATUS EMBED
 END
 WEB
    ...
    METADATA
      "wms_title"           "WMS"
      "wms_srs"             "epsg:4326"
      "wms_extent"	    ...
      "wms_onlineresource"  "http://example.com/cgi-bin/mapservice"
      ...
    END
 END
 [LAYERCONFIGURATION]
END

I'm using MapServer 5.6, data comes from shapefiles and Postgis-DB.


It is quite important to have an scalebar rendered in the image so the
user can estimate the objects length.

I also tested the scalebar from OpenLayers and for epsg:4326 its also
wrong. When I use epsg:3857 with the geodesic=true option the scalebar
in OpenLayers looks correct. Whereas MapServer is still wrong.


Is MapServer able to calculate an correct scalebar for 4326?
Should I use an other projection?
In which cases does MapServer create a reliable scalebar?


Thank you in advance for any hints.


Lars


More information about the mapserver-users mailing list