6
CARTODB: VISUALIZE SPATIAL DATA ON THE WEB Thematic Mapping of Enschede socio-economic data Barend Köbben Version 2.1 [Enschede] November 7, 2014 Contents 1 The CartoDB web application 1 2 Mapping socio-economic data for the Enschede neigh- bourhoods 1 3 Using the CartoDB web interface and wizards 2 3.1 Creating a data table .................. 2 3.2 Creating a map ..................... 2 3.3 Changing the map visualization ............ 3 3.4 Changing the info window contents .......... 4 3.5 Adding layers ...................... 4 3.6 Publishing your visualizations ............. 4 ©ITC—University of Twente, Faculty of Geo–Information Science and Earth Observation. This document may be freely reproduced for educational use. It may not be edited or translated without the consent of the copyright holder.

CARTODB: VISUALIZE SPATIAL DATA ON THE WEB Thematic ... Web... · 3.1 Creating a data table We will first have to import the data into the web site’s database. Task 3 : After you

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CARTODB: VISUALIZE SPATIAL DATA ON THE WEB Thematic ... Web... · 3.1 Creating a data table We will first have to import the data into the web site’s database. Task 3 : After you

CARTODB: VISUALIZE SPATIAL DATA ON THE WEBThematic Mapping of Enschede socio-economic data

Barend Köbben

Version 2.1 [Enschede]November 7, 2014

Contents

1 The CartoDB web application 1

2 Mapping socio-economic data for the Enschede neigh-

bourhoods 1

3 Using the CartoDB web interface and wizards 2

3.1 Creating a data table . . . . . . . . . . . . . . . . . . 23.2 Creating a map . . . . . . . . . . . . . . . . . . . . . 23.3 Changing the map visualization . . . . . . . . . . . . 33.4 Changing the info window contents . . . . . . . . . . 43.5 Adding layers . . . . . . . . . . . . . . . . . . . . . . 43.6 Publishing your visualizations . . . . . . . . . . . . . 4

©ITC—University of Twente, Faculty of Geo–Information Science and EarthObservation. This document may be freely reproduced for educational use. It maynot be edited or translated without the consent of the copyright holder.

Page 2: CARTODB: VISUALIZE SPATIAL DATA ON THE WEB Thematic ... Web... · 3.1 Creating a data table We will first have to import the data into the web site’s database. Task 3 : After you

Key points

This is an exercise description for a hands-on workshop toexperiment with web-based technologies to visualise spatialdata. You will use CartoDB, an interactive web site, tovisualize your spatial data on the web.

1 The CartoDB web application

CartoDB is an interactive web site that you can use to visualize yourspatial data on the web. On their website (http://cartodb.com)they describe it as follows: “CartoDB is a product of Vizzuality,a data visualization consulting company, and was first created tomeet the companyńs own internal needs to map large and complexgeospatial data sets. While using the platform for various internalprojects we realized its full usefulness and potential and decided tomake it open source”.

On the site there is also a small intro movie: http://vimeo.com/

vizzuality/introducing-cartodb

CartoDB is free to use for testing and small projects (using up to5 data tables and 5Mb of data storage), but you will need to signup for it:

Task 1 : Go to the website and click the “Sign up now” button.Put in your details and create your account. •

2 Mapping socio-economic data for the Enschede neighbourhoods

We will use socio-economic data for the “buurten” (neighbourhoods)of Enschede municipality . This data was retreived from the Nether-lands Central Bureau of Statistics in 2011. The data can be foundin your data directory: There is a file enschede-data.zip, whichis a ZIPped version of a shape file, and the data directory alsoincludes a small document with metadata for this dataset.

Now create and publish maps for selected other attributes in thesocio-economic dataset:

Task 2 : Out of the available attributes, select at least fourthat you think together would form a representative view of thedifferent neighbourhoods. For each of the data attributes, thinkcarefully which of the map types you should be using according

© ITC–University of Twente, Faculty of Geo–Information Science and Earth Observation 1

Page 3: CARTODB: VISUALIZE SPATIAL DATA ON THE WEB Thematic ... Web... · 3.1 Creating a data table We will first have to import the data into the web site’s database. Task 3 : After you

to the rules of Cartographic Grammar and the Thematic Mappingtheory that you have learned.

Try to have at least one map for every thematic map type that canbe created in the CartoDB wizards. . . •

Below you will find a general quick overview of how thematic map-ping in the CartoDB web interface is achieved. Apply this infor-mation to fulfil the task 2 described above.

3 Using the CartoDB web interface and wizards

3.1 Creating a data table

We will first have to import the data into the web site’s database.

Task 3 : After you have logged in to the CartoDB site, Clickthe “Create you first table” button. Click “select a file” and browseto the file enschede.zip. You do not have to unzip the archivefirst, CartoDB uploads the file, unzips the shape file and then im-ports it into the PostgreSQL/PostGIS database on the CartoDBservers. . . •

Note: PostgeSQL/PostGIS is a popular Open Source spatialdatabase back–end that stores the spatial data using the OpenGeospatial Consortium Simple Features specifications. As a plat-form, the object–relational DBMS PostgreSQL is a solid DBMSthat has a reasonably gentle learning curve, yet is very appropri-ate for advanced database applications, and its documentation isvery transparent. PostGIS in addition, is the leading open stan-dards implementation of spatial vector management, and enjoysa lively and supportive user/developer community.

You can now use this data in several ways. Because it is stored ina database, you can use the tools to do selections, editing and evenspatial analysis. If you are familiar with the SQL query language,you can use the small “SQL” tab in the right-hand side to directlywork with the data in SQL.

3.2 Creating a map

But of course, you can also show the data as a map:

Task 4 : Click the “Map View” tab. You see the data shownon top of a general background map. You can change which back-ground map to use with the ‘Basemap’ menu at the top. There

2 Dept. of Geo–Information Processing

Page 4: CARTODB: VISUALIZE SPATIAL DATA ON THE WEB Thematic ... Web... · 3.1 Creating a data table We will first have to import the data into the web site’s database. Task 3 : After you

are familiar layers such as the Google Maps (“Gmaps Roadmap”,etc.). The layers called “CartoDB” are visualizations made by theCartoDB people on the basis of OpenStreetMap data.

Now try to zoom out so that the whole Enschede dataset is shown,on a suitable background map layer. . . •

3.3 Changing the map visualization

You can click on the “wizards” tab to change the way the data ismapped. There are wizards to generate four basic types of thematicmaps:

1. Simple: This is a simple type where all elements (in ourcase polygons) are mapped the same. You can use the menusbelow to set Polygon Fill and Stroke colors, as well as theirtransparencies. You can also choose to label the elementswith the content of one of the attribute fields;

2. Choropleth: A “choropleth map” depicts relative ratio val-ues in different colour values. Colour values for cartographersare shades of a colour: E.g. ranging from white to black, orfrom light red to dark red.

3. Category: This is what cartographers call a “chorochromaticmap”, where you map nominal (sometimes called categorical)attributes with an polygon fill for each different instance.

© ITC–University of Twente, Faculty of Geo–Information Science and Earth Observation 3

Page 5: CARTODB: VISUALIZE SPATIAL DATA ON THE WEB Thematic ... Web... · 3.1 Creating a data table We will first have to import the data into the web site’s database. Task 3 : After you

4. Bubbles: This is what cartographers call a “proportionalpoint symbol map”, where you proportionally scale symbols(in this case circles) with some numerical attribute.

You can also tweak the mapping beyond the wizard possibilities! !by using the more powerful CartoCSS styling: Advanced stylingwith CartoCSS uses the concept of Cascading Style Sheets (a W3Cstandard for styling in webpages) to style the maps. The CartoCSSlanguage is an easy, flexible, and powerful way to making a betterlooking map. If you know how to use CSS to style websites, youalready know how to use CartoCSS. The CartoCSS tab also has alink to the reference site for the CartoCSS language. In this exercisewe will not use these more elaborate styling possibilities.

3.4 Changing the info window contents

Note that if you click anywhere in your map, an Info Window willpop up with the attribute data of the polygon you clicked on. Youcan actually edit which of the data attributes will be shown:

Task 5 : Click the “info window” tab. You see all the attributesfound in the data, with a small switch to change the visibility in theinfo window (on/off), as well as a “title” checkbox to determine ifthe title (name) of the attribute should be show also. Experimentwith this until you get the items in the info window that you findrelevant to show. . . •

3.5 Adding layers

You now have a map with two layers: a Base Layer and the addedthematic layer. You can add additional thematic layers to this map:Simply use the “Add layer” button to add additional map layers,either from the same data or from other data sets.

3.6 Publishing your visualizations

CartoDB offers a wizard to publish your maps on the WWW forothers to use. Once you have a map view, with all the layers thatyou like and want to publish, you can click the “publish” button thatappears in the upper-right corner of the page. A dialog will pop up

4 Dept. of Geo–Information Processing

Page 6: CARTODB: VISUALIZE SPATIAL DATA ON THE WEB Thematic ... Web... · 3.1 Creating a data table We will first have to import the data into the web site’s database. Task 3 : After you

that lets you configure the interface of the map (e.g. whether youdo or do not want a search box, a layer selector etcetera).

At the bottom of the dialog you can copy several types of links forpointing your users to:

1. a simple web URL where the users can find your map;

2. HTML code to use for embedding the map in a web page ofyour own;

3. an API URL that can be used to integrate the map in a largerweb application of your own.

© ITC–University of Twente, Faculty of Geo–Information Science and Earth Observation 5