Wednesday 29 July 2015

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 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.

Clay Deposits
Red Circles rep Points of Clay deposit occurrence

Spatial Data by mapsnigeriainitiative

www.mapsnigeriainitiative.wordpress.com
>
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}}}
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 into using TileMill. A lot more interesting and serious work can be done with TileMill especially as it is integrated with Mapbox.

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

Sunday 26 July 2015

Publishing FEATURE layers in arcmap as a feature service in ArcGIS online



Task
This short demonstration shows how to share a map or feature layer with ArcGIS online as a feature service.Our map –Selection by Location Demonstration was put together in ArcMap 10.2. The demo will illustrate how to share the map feature layers- Streets, Parcels, Low, Medium and High Tariff Blocks layers to ArcGIS Online as a  Feature layer/service.

ArcMAp must be connected to ArcGIS Online resources. USER MUST BE CONNECTED TO THE INTERNET

Note- This process can only be done by an organizational account holder. See our post titled- Lets look at ArcGIS Online… for more details about ESRI ArcGIS Online accounts.

Procedure
In ArcMap 10.2. Add the feature layers that make up the map. The demo has five layers. Go to File > Sign in. Sign into ArcGIS Online.
Capture-1

Go to File> Share As > Service.
Capture-6

This dialog box will pop up. Pick Publish a service.
Capture-7
Choose the connection that indicates the username for the organizational account. The default is to choose the name of the map in arcmap but the User can change it.
Capture-8

In the next dialog box, Click on the capablities –Choose - Feature access (red box)–instead of tile mapping. Item description (green box) describe the feature service, tag it and give a summary.
Capture-9


Click on sharing and select everyone in organization and public.
Capture-10


Click Publish (red box). During the publishing process, the system might identify errors and pause the process so the User can be correct them. Correct as many as possible and continue to publish.
Capture-10


The contents are transferred online, server side processing and a message box indicating that the service was published.
Capture-12Capture-13Capture-14


Sign into ArcGIS Online and Go to MY CONTENT (red box) to check the feature layer.
Capture-15


In the default folder, the feature layer and service definition layer should be present, For the demo, the feature layer is green boxed.
Capture-17

Wednesday 22 July 2015

Creating Charts and Graphs in QGIS 2.8



Our dataset for this demonstration consist of a Point feature layer-ConcentrPT, a CSV Table of attribute data on the points and a polygon feature layer of the extent in which the points are located. See the layers window of the screenshot below.
Capture-1

To download and practice with our dataset, click this link and download the zipped folder:
https://drive.google.com/folderview?id=0B8z8JZ83pZMaflZMcGJaZm1VT0VKbldPZFlVZDZnZWE0Y1ZhbF9GTmNfZEFJOGRVcEduNUk&usp=sharing

Let us first do an Attribute table JOIN between the attribute table of Spatial Point layer and the CSV table.
Right Click on the Point feature layer > Properties. (Another option is to double click the Point feature layer).
Capture-2

In the Layer Properties window, Click on Joins (red boxed lettered 1). Click on the green + button sign (red boxed lettered 2) to add a Join.
Capture-3

In the Add vector join dialog box, select the Join Layer and the attribute fields for Join field and Target field. These fields must have similar values to be able to perform the join. Click OK.
Capture-4

Right Click on the Point feature Layer > Open Attribute Table. Inspect the attribute table to ensure the Join was successful. The red boxed area are the values from the CSV table now joined to the corresponding locations on the attribute table of the Point feature layer.
Capture-5

With our data ready, let us proceed to create a chart illustrating the %concentrations of the different elements at each location on a map.
Right Click on the Point feature layer > Properties.
Capture-6

In the Layer Properties window- Click on Diagrams (red box 1) > Diagram Type (red box 2) to choose the diagram type. First let us pick Pie chart.  Below are four tabs, Appearance, Size, Position and Options.
Move down to the Attributes section. Select from the attributes the fields that would make up the chart, Click on the green + button to add to the Assigned attributes tab.
Capture-7

Click on Size tab. The default size is 30mm but can be adjusted by the User. Size units come in mm and map units.
Capture-8

Click on the Position tab. Placement has various options and determines where the chart will be placed. For the demo, Over Point is selected. Click Ok.
Capture-9

In the screenshot below are the Pie charts that were created. The Pie chart shows the %concentration of each of the elements on every location.
Capture-10

Next we decide to create Histogram diagrams instead of Pie charts to illustrate the information.
Right Click on the Point feature layer > Properties. In the Layer Properties window, click Diagrams and in the Diagram type select Histogram.
For the Histogram, the Appearance and Position tabs are the most relevant. In the Position tab, Placement is selected as Around Point this time around.
Capture-14

In the Appearance bar, adjust the Bar width from default to a suitable value. For the demo, Bar width value was increased to 4.
Capture-15

Viola! and there are our Histogram depicting the %concentration of different elements at each point.
Capture-16

Thank you for reading. Send your comment and feedback.

Sunday 19 July 2015

Adding custom map tiles from Stamen as Tile layers in ArcGIS Online



Adding custom base maps gives the user the freedom to place layers on base maps generated from other sources. For the demo. the source of our custom base map is from Stamen maps.  Browse to maps.stamen.com and have a look at the several types of map styles available.
*Tile layers must be hosted online.

Steps

1) First we prepare a custom image at maps.stamen.com

This is the home page.
Capture-1

Click on Find (cursor finger). For the demo, the area of interest is abuja, Nigeria (stated in the search box).
Capture-2

There are options of map styles to select from- Toner, Watercolor and Terrain. For the demo, Watercolor is selected (see cursor finger position).
Capture-19

Zoom in to the area of interest where user is particular about.
Capture-22

Click on to allow the crop tool to be activated on the map.
Capture-23

Use the yellow rectangular box to clip out the extent of map. In the red boxed area in the upper part of the screenshot, select the map style and the image size.
For the demo, watercolor is the map style and 400 by 400 pixel size. Click on MAKE.
Capture-24

Once the process of creating the image is complete, the finished image will appear on the right pane. Click on the image (see cursor finger position).
Capture-26

The image will be displayed along with details on size, time created and the geographical coordinate extents.
Capture-27

Right Click on the image and scroll down to click on ‘Copy Image Location’ (see position of cursor finger).
Capture-28

2) Add the Custom image as Base map in ArcGIS online

Open ArcGIS online > On home page click on MAPS to open a new map.
Go to Add > Add Layers from Web.
Capture-16

In the Add Layer from Web window, Select A Tile Layer in the drop down list.
Capture-17

Paste the URL of the Stamen image copied earlier. Check the Use as Basemap option. Click ADD LAYER button.
Capture-31

The Tile layer is added as base map in ArcGIS online.
Capture-32

Thank you for following the blog so far. Let us have your feedback and comments.