Labeling Markers in TileMill

Today  the post will demonstrate how to label markers or points using TileMill.

The task is to use the attribute values of a point layer to label the markers on the map. In addition, these labels will be placed right within the markers.

Download the sample data here-

Launch TileMill and Create a new project. Click on Layer icon (red boxed 1) and then Add layer. Add the Sample dataset (red boxed 2) and the style is also created on the style.mss window.


Click on the features icon of the new vector layer and inspect the attribute table. The values to be used for the labeling are inside the attribute field-PH.


image We made the following changes to the default styles. Take a look at our changes and edit the corresponding lines of code on the style.mss window. The edits will change the color of the map background, increase the marker size and color as well give it opacity. The screenshot below is an example of what the map window should look like after the editing of the default CartoCSS codes. Remember to Click Save to effect the changes.


image Write these lines of code as a new layer in the style.mss window and click Save. This lines of code will add values in the attribute field-PH as labels within the circular marker symbols. See screenshot below for the example of how the map should look. Now the attribute values from the PH attribute field are inside their corresponding marker symbols.


In this few steps, we have demonstrated how to label your markers with values from an attribute field using TileMill.

Thank you for following the blog.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s