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- https://www.dropbox.com/s/yz13dsnje27ykft/OccurClay.csv?dl=0

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.

Capture-1

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.

Capture-2

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.

Capture-3

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.

Capture-4

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.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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