[mapserver-users] mapserver scalebar

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Fri Sep 16 07:05:47 EDT 2011


Hi,

A meter based scalebar cannot work very well with epsg:4326 because the more north you go the narrower is the 1 degree slice in east-west direction. Therefore you will have a different scale in the top of the map and in the bottom. Some estimate could be done according to the latitude in the middle of the image, in your case ~120 m. However, the scale is also different in the east-west and south-north directions.
Use a coordinate system like UTM and the scalebar will be right. EPSG:3857 has the same trouble with scale changing according to latitude, though in a bit different way. Lappland is not as wide as in this map, not to mention the gigantic Svalbard http://osm.org/go/1mH7

-Jukka Rahkonen-

Lars Lingner wrote:


> 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
> _______________________________________________
> 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