[Mapserver-users] Scalebar showing wrong units

Michael Härtel mhaerte1 at gwdg.de
Mon Apr 14 06:35:51 EDT 2003


Dear MapServ-Experts!

I try to set up an internet map with MapServ3.6 but it seems that the 
scalebar alsways shows the wrong units (refer to:
"http://134.76.76.96/cgi-bin/mapserv.exe?map=H:\_webroot_\MapServ\nbu\nbu.map")

in your mapfile reference it reads "UNITS 
[feet|inches|kilometers|meters|miles]: Output scalebar units, default is 
miles. Used in conjunction with the map's units to develop the actual 
graphic. Note that decimal degrees are not valid scalebar units."

Although all layers (shapefiles) in my map are in longlat coordinates 
based on WGS84 and no "real" map units (distance units) like miles or 
kilometers can be extracted directly from the map projection, i think 
that it should be possible to display a correct scalebar (assuming that 
the distance between every meridians at all latitudes is same (poles are 
displayed as lines).

Have i done somoething wrong in the mapfile or is it simply not possible 
  to generate a correct scalebar if only longlat layers are used (I 
guess most od free GIS data that is available in the internet is based 
on LONGLAT and WGS84)?

Maybe you can take a look at my mapfile:

----------
NAME NBU
#EXTENT -10 40 30 60
#EXTENT -20 45 40 55
EXTENT -180.000000 -90.000000 180.000000 90.000000
SIZE 600 300

PROJECTION
	proj=longlat
	ellps=WGS84
	datum=WGS84
	no_defs
END

SHAPEPATH "H:\_webroot_\MapServ\nbu"
FONTSET "d:\windows\fonts\fonts.list"
SYMBOLSET "H:\_webroot_\MapServ\nbu.sym"

WEB
   TEMPLATE "H:\_webroot_\MapServ\nbu\search.html"
   IMAGEPATH "tmp\"
   IMAGEURL "http://127.0.0.1/MapServ/nbu/tmp/"
END

LEGEND
   # IMAGECOLOR 110 110 150 #standard
   IMAGECOLOR 125 125 160 #bright
   # IMAGECOLOR 90 90 130 #dark
   # IMAGECOLOR 140 140 200 #head
   INTERLACE ON
   OUTLINECOLOR -1 -1 -1
   KEYSIZE 20 10
   KEYSPACING 5 5
   TRANSPARENT ON
   STATUS ON #EMBED #ON #EMBED #OFF
   LABEL
     TYPE TRUETYPE
     FONT arial
     COLOR 0 0 0
     SIZE 12
     ANTIALIAS TRUE
     # SHADOWCOLOR 255 255 255
     # SHADOWSIZE 2 2
   END
END

SCALEBAR

BACKGROUNDCOLOR 0 0 255
COLOR 0 0 0
IMAGECOLOR 125 125 160
INTERLACE true
INTERVALS 2
STYLE 1
SIZE 100 5
STATUS on
TRANSPARENT on
UNITS meters #[feet|inches|kilometers|meters|miles]
	LABEL
		#Type truetype
		#font arial
		#OUTLINECOLOR 255 255 255
		#SHADOWSIZE 2 2
		size small
		POSITION uc #[ul|uc|ur|ll|lc|lr]
		POSTLABELCACHE true	
	END
END

REFERENCE
   STATUS ON
   IMAGE "H:\_webroot_\MapServ\nbu\reference.gif"
   SIZE 200 100
   EXTENT -180 -90 180 90
   COLOR -1 -1 -1
   OUTLINECOLOR 255 0 0
END

############################## LAYER DEFINITIONS 
###################################


LAYER # Shaded Relief Raster
	PROJECTION
		proj=longlat
		ellps=WGS84
		datum=WGS84
		no_defs
	END
	
	NAME "relief"
	STATUS DEFAULT
	TILEINDEX "world/bitmaps/index_map.shp"
	TILEITEM "path"
	TYPE RASTER
END # Shaded Relief Raster

################################################

LAYER	#country borders
	PROJECTION
		proj=longlat
		ellps=WGS84
		datum=WGS84
		no_defs
	END
NAME "World Land Area"
   DATA world/land_area
   STATUS DEFAULT
   TYPE POLYGON
	CLASS #country border
		NAME "country borders"
		#COLOR 200 200 200
		OUTLINECOLOR 0 0 0
	END # country border
END # layer country borders

################################################

LAYER	#germany
	PROJECTION
		proj=longlat
		ellps=WGS84
		datum=WGS84
		no_defs
	END
   NAME "germany"
   DATA world/land_area
   STATUS DEFAULT
   TYPE POLYGON
	CLASSITEM "Cntry_name"
	CLASS #germany
		NAME "Germany"
		EXPRESSION ('[Cntry_name]' = 'Germany')
		# COLOR 0 0 255
		OUTLINECOLOR 0 0 255
	END # class #germany
END # layer germany

LAYER	# labels
   NAME "labels"
   DATA world/land_area
   STATUS DEFAULT
   TYPE ANNOTATION
	LABELITEM "Cntry_name"
	#CLASSITEM "Cntry_name"
	
	CLASS #labels
		NAME "labels"
		#EXPRESSION 'Germany'
		COLOR 0 0 255
		
		LABEL
			COLOR 255 255 255
			SHADOWCOLOR 0 0 0
			SHADOWSIZE 2 2
			TYPE TRUETYPE
         		FONT ARIAL
  			SIZE 10
			ANTIALIAS TRUE
			POSITION CL
			PARTIALS FALSE
			MINDISTANCE 250
			BUFFER 4
		END #  label
	
	END # class labels
END # layer labels

################################################

LAYER	#wrs2

NAME "wrs2"
	PROJECTION
		proj=longlat
		ellps=WGS84
		datum=WGS84
		no_defs
	END
   DATA wrs2/wrs2
   STATUS OFF
   TYPE POLYGON
	# CLASSITEM "PATH"
	CLASS #wrs2
		NAME "WRS-2 frames"
		# EXPRESSION ('[path]' = '195')
		# COLOR 0 255 0
		OUTLINECOLOR 255 0 0
	END # class wrs2
END # layer wrs2


END # end of map file

-----
Thanks for any reply,

regards,

M. Härtel
-- 
Michael Härtel
Georg-August University Goettingen
Department of Geography
Cartography, GIS & Remote Sensing Section
project Notebook University, Internet Map Service
Goldschmidtstr. 5                           Tel.: +49 (0)551/39-12671
37077 Göttingen                             Fax : +49 (0)551/39-8020
http://www.geogr.uni-goettingen.de/kuf/




More information about the mapserver-users mailing list