Creating a simple map using TileMill

This post will demonstrate in an introductory way how to use TileMill to produce simple maps. TileMill is an offline map production tool which preceded the development of Mapbox Studio.

With the advent of Mapbox Studio, TileMill is now no longer in development but here is the catch- Mapbox Studio is entirely web based while TileMill can be used offline. For many of us GI users in the third world, internet services are quite expensive so an offline tool like TileMill is a great option.

– Download TileMill to your PC.

-Download the sample data by clicking here- TileMill sample data

(Kindly attribute the Point feature data-claypoints to http://www.mapsnigeriainitiative.wordpress.com)

 

Launch TileMill on your desktop. Click on Project (red box 1) and then click on New project (red box 2) to start.

Capture-1

 

In the New project window, fill in the details as below. Click Add

Capture-3

 

Click on the New project in the next page. See our demo example on screenshot below.

Capture-4

 

A Map page with the name of the project you just created will open.

Capture-5

 

Add Layers

 

Click on the icon in the red box and the Layers window will open. Click Add layer (cursor finger position). A default layer- #countries is always there.

Capture-6

 

In the Add layer window, Click on Browse (cursor finger position on the screenshot) to navigate to where the sample data was saved.

Capture-7

 

Select the Sample point data-ClayPoints.shp and Click Done (red boxed on the screenshot).

Capture-8

 

In the next page, Click Save & Style option (cursor finger position on the screenshot below)

Capture-9

 

The Point features are added on the map window as well as a Style layer (red boxed area) in the style.mss window on the right.

Capture-12

 

Using the same procedure as shown above for Adding layer, we add our second dataset- the polygon map ngaadm0 (red boxed in the Add layer window). A Style layer is also added for our polygon layer in the style.mss window. Move the Polygon layer below the Point features layer.

Capture-15

 

Styling the Map

Typically, layers are brought into the style.mss window and assigned default style. TileMill allows the GI user to adjust or write customized cartoCSS codes in order to better style the map. For GI users not familiar with CartoCSS, Click on the {} icon just above the Layers icon to read TileMill tutorial on it.

Let us edit the layer style on the polygon style layer.

#ngaadm0 {

line-color:#813;

line-width:1;

polygon-opacity:1;

polygon-fill:#827a7a; Here we change the fill color from green to dark grey.

}

Click Save to save any changes you have made in the style.mss window. The polygon map fill has changed from green to dark grey

Capture-16

 

Next, edit the Style layer for the claypoints.

#claypoints {

marker-width:8; Increase the marker –width to 8 to make them bigger

marker-fill:#f45;

marker-line-color:#fff; Change the outline color for the marker to white

marker-allow-overlap:true;

}

Click Save and the markers should have a clear white outline around them. Also their shape size would increase marginally.

Capture-18

 

Make a Legend and Teaser

 

Click on the Templates icon (red box1) and click on Legend (red box 2). In TileMill, legends are written out using HTML tags.

Capture-20

 

You can copy and paste our own example from below then Click Save.

 

<strong style=”color:red;font-size:15px”;> Clay Deposits</strong><br>

<strong><em> Red Circles rep Points of Clay deposit occurrence</strong></em><br><br>

<strong style=”font-style:italics”;><small>Spatial Data by mapsnigeriainitiative</strong></small><br>

<a href=”www.mapsnigeriainitiative.wordpress.com”>www.mapsnigeriainitiative.wordpress.com</a>

 

Teasers

Teasers are simply the same thing as pop-up infowindows that give the map user information on features on the map.

Click on the Templates icon (red box 1), then on the Teaser (red box 2) and go down to where you have a drop down button labeled Layer to use for interaction data. Click on the drop down button and choose claypoints on the menu. A list of the layer’s attribute fields will be displayed. The attribute fields will be enclosed in mustache tags {{{ }}} (see lower left end of screenshot).

Capture-21

 

Copy and paste in the main window two tags as seen on the screenshot below

or just copy and paste our example:

State: {{{NAME_1}}}<br>

Region: {{{Region}}}

Click Save.

Capture-22

 

Hover the mouse over a Point feature and a Teaser window should pop-up (See our demo example green boxed in the screenshot).

In the bottom corner of the map, the legend box is red boxed on the screenshot.

Capture-23

 

Export Map

Now that our map is ready, lets export the map. For this introductory stage, we will export just as a png image.

Click on Export and select png from the drop down menu.

Capture-24

 

The Export PNG window opens. Use the cursor and shift button to adjust the spatial extents of the map. In most cases, adjust the bounds of the map close to the extent of the layers. Click Export.

Capture-25

 

Once the export process is completed, click Save to download the image onto the PC.

Capture-26

 

This is an introductory demonstration on using TileMill. A lot more interesting work can be done with TileMill especially when it is integrated with Mapbox.

Thank you for reading and following our blog. We hope you will find it always useful.

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