Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

DescriptionLabel SnippetThumbnail

Single Line

Code Block
STYLE # thick outline 
   COLOR 25 29 173
   SIZE 2
END

Double Line

Code Block
STYLE # thick outline 
   COLOR 0 0 0
   SIZE 6
END
STYLE # colour middle 
   COLOR 178 172 235
   SIZE 3
END

...

Graduated symbol size is handled by using a numerical attribute for the symbol size.

In this example there are two classes for emphasis
DescriptionLabel SnippetThumbnail

Simple PIXMAP (external graphic) symbol

. Needs defining

Here the SYMBOL is definined in the relevant symbols .sym file or in the MAP header - See Symbols & Styling for other examples. 

Code Block
		CLASS
			NAME ""
			STYLE
				SYMBOL "hospitals"
			END
		END

Scaled Symbology

Separate classes for scaled symbology and ensure that Legend Graphic isn't confusing. In this example there are three classes for emphasis.

In this example the size of the circle depends upon the zoom level.

Code Block
		CLASS
			MAXSCALEDENOM 5000
			NAME ""
			STYLE
				SYMBOL "circle"
				COLOR 255 255 128
				OUTLINECOLOR 0 0 0
				SIZE 7
			END
		END
		CLASS
			STYLE
				SYMBOL "circle"
				COLOR 255 255 128
				OUTLINECOLOR 0 0 0
				SIZE 4
				MINSCALEDENOM 5000
				MAXSCALEDENOM 25000
			END
			STYLE
				SYMBOL "circle"
				COLOR 255 255 128
				SIZE 2
				MINSCALEDENOM 25000
			END			
		END
Image Removed

Image Removed

 

Image Removed

END
Image Added

Image Added

 

Image Added

Graduated Point Thematic

Graduated symbol size is handled by using a numerical attribute for the symbol size. In this example there are two classes for emphasis.

The CLASSITEM entry defines the field that is to be used in the EXPRESSION etc. size_percent in this example.

  1. In the first CLASS we are saying that if the value of size_percent is less than 8, i.e. Minor Crime, then the colour will be blue. Also the size of the circle will be dependent upon the value of size_percent.
     
  2. In the second CLASS, which will catch anything that doesn't match the first CLASS EXPRESSION, i.e. Major Crime, then the colour will be red. Here also the size of the circle will be dependent upon the value of size_percent.



 

Code Block
CLASSITEM "size_percent"
CLASS
	NAME "Minor Crime"
	EXPRESSION ([size_percent] < 8)
	STYLE
		SYMBOL "circle"
		SIZE [size_percent]
		COLOR 0 0 255
	END
END
CLASS
	NAME "Major Crime"
	STYLE
		SYMBOL "circle"
		SIZE [size_percent]
		COLOR 255 0 0
	END
END

...

DescriptionLabel SnippetThumbnail

Coloured Boundary – Transparent Fill

Code Block
STYLE
   COLOR -1 -1 -1
   OUTLINECOLOR 222 0 0
   WIDTH 2
END

Coloured Boundary – Coloured Fill

Code Block
STYLE
   COLOR 156 215 57
   OUTLINECOLOR 0 0 0
   WIDTH 2
END

...

DescriptionLabel SnippetThumbnail

Label - with POSITION UC

Place the Label as Upper Centre

Code Block
languagebash
		CLASS
			NAME ""
			STYLE
				SYMBOL "circle"
				COLOR 0 196 0
				OUTLINECOLOR 255 255 255
				SIZE 16
			END
			LABEL
				FONT "verdana"
				TYPE truetype
				SIZE 8
				POSITION UC
				COLOR 0 0 0
				OUTLINECOLOR 255 255 255
				OUTLINEWIDTH 3
				MAXLENGTH 12
				WRAP " "
				ALIGN CENTER
				BUFFER 10
			END		
		END

Concatenate fields (TEXT) and then WRAP on their comma

Code Block
languagebash
		CLASS
			NAME ""
			TEXT "[stop_name],[place],[postcode]"
			STYLE
				SYMBOL "triangle"
				COLOR 0 196 0
				OUTLINECOLOR 255 255 255
				SIZE 16
			END
			LABEL
				FONT "verdana"
				TYPE truetype
				SIZE 8
				POSITION UC
				COLOR 0 0 0
				OUTLINECOLOR 255 255 255
				OUTLINEWIDTH 3
				MAXLENGTH 12
				WRAP ","
				ALIGN CENTER
				BUFFER 10
			END		
		END

Concatenate fields inside an SQL if using PostgreSQL

(as opposed to the TEXT "[field1] field2 etc"

 

This gives utmost flexibility to how the text can be treated

Code Block
DATA "wkb_geometry from
 (select *, coalesce(pn::text,rn::text) as hwy_name 
from upload_multi.hw_saltng_ntwrk) 
as foo using 
unique ogc_fid 
using srid=27700"
LABELITEM "hwy_name"
 

ANGLE FOLLOW and MINFEATURESIZE AUTO

With the second screen shot you can see how the labelling can now fit within the FEATURE and therefore MINFEATURESIZE AUTO allows for this

 

MINFEATURESIZE also allows for the restriction according to the Minimum Bounding Rectangle of a feature (in pixels)

Code Block
		CLASS
			NAME ""
			STYLE
				PATTERN 10 5 5 10 END
				WIDTH 2
				COLOR 0 0 255
				OUTLINECOLOR 255 255 255
				
			END
			LABEL
				FONT "verdana"
				TYPE truetype
				SIZE 7
				POSITION LC
				COLOR 0 0 255
				OUTLINECOLOR 255 255 255
				OUTLINEWIDTH 4
				ANGLE FOLLOW
				MINFEATURESIZE AUTO
			END	

How can I label certain features and not others?

 

Code Block
CLASS
   NAME "Capitals"
   TEXT ([NAME])
   EXPRESSION "1"
   STYLE
      SYMBOL "square"
      COLOR 0 0 0
      SIZE 6
   END
   LABEL
      FONT "arialbd"
      TYPE TRUETYPE
      COLOR 0 0 255
      OUTLINECOLOR 255 255 255
      SIZE 10
      POSITION cc
   END         
END
CLASS
   NAME "Others"         
   EXPRESSION ([Rank] > 1)
   STYLE
      SYMBOL "circle"
      COLOR 255 0 0
      SIZE 3
   END
END

As above with extra Label with different colour.

 

Code Block
CLASS
   NAME "Capitals"
   TEXT ([NAME])
   EXPRESSION "1"
   STYLE
      SYMBOL "square"
      COLOR 0 0 0
      SIZE 6
   END
   LABEL
      FONT "arialbd"
      TYPE TRUETYPE
      COLOR 0 0 255
      OUTLINECOLOR 255 255 255
      SIZE 10
      POSITION cc
   END         
END
CLASS
   NAME "Others"         
   EXPRESSION ([Rank] > 1)
   STYLE
      SYMBOL "circle"
      COLOR 255 0 0
      SIZE 3
   END
   TEXT ([NAME])
   LABEL
      FONT "arialbd"
      TYPE TRUETYPE
      COLOR 255 0 0
      OUTLINECOLOR 255 255 255
      SIZE 8
      POSITION cr
   END         
END

...