When to use shape maps in data visualisation: part 2 of a great big guide

maps xkcd

xkcd’s take on mapping, via Duarte Romero

In a previous post I explained some of the considerations in deciding to use a map in data visualisation, and went into detail about mapping points and heatmaps. In this second part, taken from the MA in Online Journalism at Birmingham City University, I’m going to look at other types of maps: shape-based maps and image maps.

Mapping shapes

A more ambitious alternative to mapping points is to map shapes: in other words, instead of each data point being placed on a specific point on a map, instead different areas on that map are drawn and coloured/labelled according to the relevant data.

Shapes can be anything: you can have a map with shapes for each country in the world or a particular continent; or you can have a map with shapes for each county in the UK, or each constituency (voting region), or local authority. Or police authority area. Or health authority.

This is particularly useful if your data does not relate to geographical points (a specific location with its own latitude and longitude) but rather to broader geographical areas, such as a town or city, region or country, or an administrative area.

And data often will only relate to areas: unemployment rates, inflation and health data will all relate to areas. You are not going to get data which shows you the location of every sick person, unemployed person, or expensive loaf of bread.

If you are to be accurate in representing these figures, shapes are the way to do it.

But they are also harder to ‘draw’ than points on a map.

This is because shapes are actually data too: a description of the coordinates and paths needed to draw each shape.

As a result, drawing a map with shapes invariably involves merging data: your data about those places; and the data containing the descriptions of those shapes.

This second set of data is often called ‘shape files’. The mapping tool OpenHeatMap, for example, has a number of shape files stored in its database, including shapes for countries, US states, UK constituencies and authorities, and administrative regions in New Zealand, Mexico, Ireland, and other places.

carbon emissions map

OpenHeatMap’s Pete Warden uses shapes to show carbon emissions

This means that you can upload your own data and mix it with those shapes to generate maps that combine the two: shapes coloured according to a specified field in your data.

More broadly, Google Fusion tables has made shape files accessible to a much wider userbase than ever before.

Fusion Tables uses a language called KML (Keyhole Markup Language) to describe shapes. This means if you need to find the shapes to combine with your data, to create a map, then it’s much easier to do so: once you upload your own data to Google Fusion Tables you can go to File > Find a table to merge with… and search all other public tables that share some information (for example the name of the regions).

Here, for example, Simon Rogers lists 16 useful Fusion Tables files for mapping shapes.

A more direct way to identify public tables is to use Google’s table search tool and specify that you want Fusion Tablesresults only. Adding ‘geometry’ to your search terms also increases the chance that you find shape files rather than just numerical or text data.

If the shapes you want to draw don’t already exist in a Fusion Tables map, you may be able to find it in another format and convert. The .SHP file format, however, is often used for shape files, and can be converted to KML at the site SHPSCAPE.

Another option is to use a JavaScript library for mapping which has the shapes you need. Or to use more advanced mapping tools like GIS.

The final option is to draw the shapes yourself. In Google Maps Engine Lite once you have drawn your maps (shapes, points, or routes) you can export as KML – then import when creating a new Fusion Table.

There’s also another option which doesn’t involve shape files at all: you can find an image showing all the regions you need, then add a layer of interactivity to convert that into an image map, as described below.

Colouring map shapes

When choosing to colour-code shapes in a map you need to consider the same issues as outlined above with regard to points: don’t choose too many colours, and keep the story clear and/or useful.

It is a good idea to use a tool like Color Brewer to help you choose the colour palette. This will suggest colour combinations which can be seen by users with colourblindness, and which also suit the type of data you are showing (ordinal, for example) (more background on founder Cindy Brewer here).

It is a good idea to use a tool like Colorbrewer to help you choose the colour palette. This will suggest colour combinations which can be seen by users with colourblindness, and which also suit the type of data you are showing (ordinal, for example). Below you can see a good example (from this article) of how different colour schemes – and colour scales – communicate different types of data more clearly.

In that piece Christopher Ingraham writes: “Mapmakers often respect big distinctions by using a bivariate color scale – say, one set of colors for positive values (like blue), and another set of colors for negative ones (like red).” Colorbrewer includes explanations of different colour scales.

Consider making shapes semi-transparent so the detail underneath can still be seen; and setting border as white rather than black.

The information window

map info window

The Fusion Tables map info window allows you to embed images from URLs in the data

Most mapping tools also allow you to customise the window which appears when a user clicks on a point or shape.

Often these default to a list of headings and values. The headings are taken from your original spreadsheet, and the values from the particular row (location) being shown.

For that reason it’s a good idea to make sure headings are clear, and to choose only the data that needs to be in that box.

But in the more advanced tools such as Fusion Tables it’s also worth taking the time to customise information windows further so that they are not merely a list of values, but rather a more readable sentence.

For example, instead of Location: Amsterdam, population: 3,000,000, burglaries per 1000: 0.5 you would customise the code to read:

In Amsterdam there are 0.5 burglaries for every thousand people. The city has a population of 3,000,000 people

Of course that requires reading up on that.

Mapping routes

Routes are mapped much less often than shapes or points, but it is worth mentioning them here too.

Tools like Meograph, Dipity and Tripline allow you to tell stories with routes, while Google Maps Engine Lite allows you to draw them and export in a format which can be used in Fusion Tables.

If your story is about a route it is worth considering these tools instead of simple points. You could also look at timeline tools like Timeline JS (and Dipity again) as routes can often be shown in this format too.

A route has its own built-in narrative which can be quite powerful. They lend themselves to photoblogging (taking images along the route) or audio or video (likewise). You could present data about each point along the route using those media (charts, for example) rather than making it about the map.

Image maps

A final type of map is not, strictly speaking, geographical at all. This is the image map.

An image map is created when an image is ‘mapped’ by overlaying interactive elements on top of it. A good example might be an image of a group of people: this could be made into an image map by bringing up information about a particular person when your mouse hovers over her, or when you click on him.

Indeed, on Facebook when you tag a person in an image this is exactly what happens. And Flickr allows you to add information to images in a similar way.

Image maps can be created with any image: it could be a picture of a complex system; a diagram; a street scene; a floor plan or schematic. In short, any image which includes elements you can tell different stories about.

Image maps are one alternative way to create interactive maps without having to use shape files: simply find a map of the regions you wish to visualise, and add a layer of interactivity on top.

The tool Thinglink is one of the easiest ways to create an image map: you upload your image, then select an area you want to make interactive, then type the text, or image, video or audio URL, that you want to appear or play when someone clicks on that part of the image.

But you can achieve the same effect and take more control with JavaScript too.

Where next? The tools

I’ve mentioned a lot of tools above. Which ones you use depends on what you want to achieve, but also how quickly and easily you want to do that.

  • BatchGeo is very quick and easy to get started with when it comes to mapping points. However, if you have more than a thousand or so rows then BatchGeo will ask you to pay to upgrade to the Pro version. At that point you might consider Google Fusion Tables as a more powerful, free, alternative.
  • CartoDB is another mapping tool which offers different functionality – for example the ability to size points based on a particular value. It also allows you to query your data and create different views using a language called SQL. Again there are limits to how much data you can store in the free account.
  • OpenHeatMap is a quick way to get started on mapping shapes – but make sure you read the documentation carefully and download the example spreadsheets for the shapes you want to use. You need to give your location column the same name as the documentation specifies, and make sure that location names match exactly (watch out for ampersands).
  • Tableau has some mapping options which are also worth exploring – particularly if you want to size placemarkers
  • Fusion Tables can do both points and shapes (and routes) and provides more customisation.

I could list dozens more, but if you have a problem which these don’t address then try searching for mapping tools or libraries that do.


2 thoughts on “When to use shape maps in data visualisation: part 2 of a great big guide

  1. Pingback: Longform para el weekend. Lecturas sobre periodismo para el fin de semana

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