[mapserver-users] duplicate labels

Andy Colson andy at squeakycode.net
Fri Jul 17 12:33:06 PDT 2009


Lars Lingner wrote:
> Andy Colson schrieb:
>> Lars Lingner wrote:
>>> Andy Colson schrieb:
>>>> Hi All,
>>>>
>>>>
>>>> Here is a screen shot:
>>>>
>>>> http://maps.camavision.com/map.jpg
>>>>
>>>>
>>>> There are, as far as I can tell, 4 lines.  The label is duplicating and
>>>> I dont want it too.  Here is the layer from the mapfile:
>>>>
>>>>
>>>>     LAYER
>>>>         NAME annotate_pin
>>>>         TYPE line
>>>>         STATUS on
>>>>         CLASS
>>>>             NAME "HIGHLIGHT"
>>>>             STYLE
>>>>                 COLOR 0 255 0
>>>>                 OUTLINECOLOR 0 255 0
>>>>                 WIDTH 3
>>>>             END
>>>>             LABEL
>>>>                 TYPE truetype
>>>>                 FONT "Vera"
>>>>                 SIZE 10
>>>>                 COLOR 0 0 0
>>>>                 ANGLE follow
>>>>                 POSITION auto
>>>>                 BACKGROUNDCOLOR 255 255 255
>>>>                 MINDISTANCE 900
>>>>             END
>>>>         END
>>>>     END
>>>>
>>>>
>>>> I have played with MINDISTANCE from 0 to 99,000 and it does not seem to
>>>> make a difference.  I googled a little but have not found a useful
>>>> answer.
>>>>
>>> If you want to use MINDISTANCE you have to set the SIZEUNITS parameter
>>> at layer level like this:
>>>
>>> LAYER
>>>  ...
>>>  SIZEUNITS meters # one of [pixels|feet|inches|kilometers|meters|miles]
>>>  ...
>>>  LABEL
>>>   ...
>>>   MINDISTANCE 500
>>>   ...
>>>  END
>>>  ...
>>> END
>>>
>>> So the label wouldn't repeated for distances smaller than 500 meter.
>>>
>>>
>>> Lars
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> That didn't seem to work.  It made all my fonts really small, but the
>> labels still duped.
>>
> 
> Do you have at MAP level the UNITS parameter?
> [feet|inches|kilometers|meters|miles|dd]

Yes, its feet.

> 
> Please try that, I should have told you that in my last reply ;)
> 
> also: which projection have you set at MAP level?
	PROJECTION
		"init=epsg:3417"
	END


> 
>> The help says layer.sizeUnits "Sets the unit of CLASS object SIZE", does
>> that include label font size?
> 
> it sets the unit of the object size, not the size itself. The font size
> is controlled by the SIZE parameter (LABEL object)
> 

Then why did the labels font size change?

>> It defaults to pixels, yes?  Wouldnt a really big MINDISTANCE still have
>> removed dups?
>>
> 
> Not necessarily... Often they are different in orders of magnitude
> 

Here is my entire mapfile, the annotate_pin layer is at the bottom:

MAP
	NAME bremer
	SIZE 800 800
	UNITS feet
	SHAPEPATH '/pub/maps/bremerIA'
	FONTSET "/pub/www/fonts/fonts.txt"

	# full extent
	EXTENT 5166680.718750 3687027.837500 5306080.031250 3802972.662500
	# testing
	#EXTENT 5191357.283967 3726454.400032 5205566.339522 3738272.725606

	PROJECTION
		"init=epsg:3417"
	END

	IMAGECOLOR 192 192 192
	IMAGEQUALITY 95
	IMAGETYPE jpeg
	OUTPUTFORMAT
		NAME jpeg
		DRIVER 'GD/JPEG'
		MIMETYPE 'image/jpeg'
		#IMAGEMODE PC256
		EXTENSION 'jpeg'
	END


	LEGEND
		IMAGECOLOR 255 255 255
		STATUS ON
		KEYSIZE 18 12
		LABEL
			TYPE BITMAP
			SIZE MEDIUM
			COLOR 0 0 89
		END
	END

	WEB
		IMAGEPATH '/tmp/'
		IMAGEURL '/tmp/'
		METADATA
			'wms_title'           'bremer'
			'wms_onlineresource'  'http://my.host.com/cgi-bin/mapserv?map=wms.map&'
			'wms_srs'             'EPSG:3417'
		END
	END


	#Circle symbol
	SYMBOL
		NAME 'CIRCLE'
		TYPE ellipse
		FILLED true
		POINTS
			1 1
		END
	END

	LAYER
		NAME "raster"
		STATUS off
		TILEINDEX "raster.shp"
		TILEITEM "location"
		TYPE RASTER
	END

	LAYER
		NAME 'parcel_point'
		STATUS off
		TYPE POINT
		CONNECTIONTYPE postgis
		CONNECTION "dbname=gis user=andy"
		DATA 'the_geom FROM bremeria.parcelpoint using unique gid using srid=3417'
		PROCESSING "CLOSE_CONNECTION=DEFER"
		METADATA
		  'wms_title' 'parcelpoint'
		END
		TRANSPARENCY 100
		LABELITEM pin

		PROJECTION
			"init=epsg:3417"
		END

		CLASS
			NAME 'parcelpoint'

			STYLE
				SYMBOL 'CIRCLE'
				SIZE 1
				OUTLINECOLOR 0 0 0
				COLOR 150 123 90
			END

			LABEL
				TYPE truetype
				FONT "Vera"
				SIZE 7
				COLOR	0 0 0
				#BACKGROUNDCOLOR 255 255 255
				#BUFFER 3
				#ANGLE 45
				POSITION auto
				PARTIALS false
				#FORCE true
			END

		END
	END

	LAYER
		NAME 'parcels'
		TYPE POLYGON
		CONNECTIONTYPE postgis
		CONNECTION "dbname=gis user=andy"
		DATA 'the_geom FROM bremeria.parcelpoly using unique gid using srid=3417'
		PROCESSING "CLOSE_CONNECTION=DEFER"
		METADATA
			'wms_title' 'parcelpoly'
		END
		STATUS off
		TRANSPARENCY 100

		PROJECTION
			"init=epsg:3417"
		END

		CLASS
			NAME 'parcelpoly'
			STYLE
				SYMBOL 0
				SIZE 2
				OUTLINECOLOR 0 0 0
				COLOR 229 210 191
			END
		END
	END

	LAYER
		NAME 'cadastral_line'
		TYPE LINE
		CONNECTIONTYPE postgis
		CONNECTION "dbname=gis user=andy"
		DATA 'the_geom FROM bremeria.cadastral_line using unique gid using 
srid=3417'
		PROCESSING "CLOSE_CONNECTION=DEFER"
		METADATA
			'wms_title' 'cadastral_line'
		END
		STATUS on
		TRANSPARENCY 100
		PROJECTION
			"init=epsg:3417"
		END
		CLASSITEM 'alphatag'
		CLASS
			NAME 'alphatag = '
			EXPRESSION ''
			STYLE
				SYMBOL 0
				SIZE 2
				OUTLINECOLOR 0 0 0
				COLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Corp Line'
			EXPRESSION 'Corp Line'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 177 214 186
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = County Line'
			EXPRESSION 'County Line'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 124 53 190
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Geo Twp Line'
			EXPRESSION 'Geo Twp Line'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 120 117 243
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Lot Line'
			EXPRESSION 'Lot Line'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 190 28 153
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Misc Line'
			EXPRESSION 'Misc Line'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 99 188 156
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Parcel Line'
			EXPRESSION 'Parcel Line'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 146 93 39
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Pol Twp Line'
			EXPRESSION 'Pol Twp Line'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 58 109 205
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Railroad Centerline'
			EXPRESSION 'Railroad Centerline'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 132 253 192
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Railroad ROW'
			EXPRESSION 'Railroad ROW'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 148 148 148
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Road Centerline'
			EXPRESSION 'Road Centerline'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 126 17 179
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Road ROW'
			EXPRESSION 'Road ROW'
			STYLE
				SYMBOL 0
				SIZE 2
				 COLOR 129 38 243
				 OUTLINECOLOR 0 0 0
			 END
		END
		CLASS
			NAME 'alphatag = Section Line'
			EXPRESSION 'Section Line'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 37 231 177
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Sub Line 100'
			EXPRESSION 'Sub Line 100'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 78 109 18
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Sub Line 400'
			EXPRESSION 'Sub Line 400'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 247 175 40
				OUTLINECOLOR 0 0 0
			END
		END
		CLASS
			NAME 'alphatag = Water Line'
			EXPRESSION 'Water Line'
			STYLE
				SYMBOL 0
				SIZE 2
				COLOR 0 0 255
				OUTLINECOLOR 0 0 0
			END
		END
	END

	LAYER
		NAME annotate_pin
		TYPE line
		STATUS on
# if I comment the SIZEUNITS out it only changes the label size
		SIZEUNITS feet
		CLASS
			NAME "HIGHLIGHT"
			STYLE
				COLOR 0 255 0
				OUTLINECOLOR 0 255 0
				WIDTH 3
			END
			LABEL
				TYPE truetype
				FONT "Vera"
				SIZE 10
				COLOR 0 0 0
				BACKGROUNDCOLOR 255 255 255
				ANGLE follow
				POSITION auto
				PARTIALS false
				MINDISTANCE 95000
			END
		END
	END
END




Thanks for the help,

-Andy



More information about the MapServer-users mailing list