How to create multiple point label

A great way to enhance your map style and optimize database attributes usage is to use "Multiple point labeling" of a layer by editing the Layer Template with Mapfile code snippet.   Here's an example of Gas stations layer 




In this use case, we print a label with a fixed prefix and suffix ("Cap: [database_value] L") and we add a buffer polygon around point symbol.  To access to this advanced feature, you will need to be sure you have Mapfile Snippet Privilege on your account.  If you are Super Admin, you have automatically access to it.  



As you see, you have access to all styling script option.  Here are some observations about the Layer Template:

  • You will need to read about how to write mapfile script on Mapserver official website
  • You will find in those articles all available Font and Symbols 
  • Values control through GUI are replaced by a variable with '@' prefix.  You can overwrite those variables and write your own. In the below example you will see a polygon layer buffer added on the top of the point layer.
  • You can add as many layers as you need between Layer Tag ID #<@id> but you need to add GROUP tag with @name variable to all new layer you add. (see below example)
  • You can write your own @subquery
  • To create multiple point label, you have to add FORCE GROUP in the LABEL tag.
  • Legend will appear differently in your layer tree.  You can manage name of your layer class through class NAME tag.

Here's a complete Mapfile snippet template to create this example:


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk