Parsons, The New School For Design
August 9, 2014
I (Chris Henrick) have a professional background in Cartography and Geographic Information Systems. In undergrad I studied human geography, urban studies and fine art. Recently I have gotten more into web development, data visualization and interactive web-mapping.
Mapping data interactively on the web using free open-source software called CartoDB.
- The Spatial Distribution of Swiss Soccer Fans
- Where Would 9 million displaced Syrians fit?
- The Geography of Abortion Access
- Andrew Hill's NYC PLUTO data tour
- Tweets about Beyonce's latest album release
CartoDB is a platform running on open-source software for visualizing and analzying data on interactive web-maps. It is perhaps the easiest method of mapping geospatial data for the web. It also allows for high cartographic customization through an intuitive user interface as well as advanced geospatial data analysis using SQL (Structured Queried Language) and Post-GIS.
Prior to CartoDB (and other opensource web-cartography software such as Tile Mill), creating webmaps involved having to install server-side software. This was extremely difficult unless you were a computer programmer / back-end web developer. The great thing about CartoDB is that it handles all of the server side stuff for you. For example, each time you import data into your dashboard in CartoDB that data is automatically stored inside a database that has geospatial capabilities.
Geospatial data refers to data that has a location based, geometric component. Most geospatial data is in vector format and is stored as points, lines and polygons whose vertices have real world x, y coordinates such as latitude and longitude. In GIS, geospatial data can be used to represent both physical and cultural features. These data can then be overlayed and analyzed to solve problems and model the enviroment.
Examples of each geometry type:
-
A list of street addresses, which can then be georeferenced (matched) to individual pairs of latitude longitude coordinates (points), such as the locations of all public schools in NYC:
-
Features such as rivers and streams or road networks can be stored as lines:
-
New York City's borough boundaries or other administrative boundaries such as states and countries can be stored as polygons:
These types of data are what is used to render map tiles like those you see on Google Maps, Bing, Map Quest, etc.
Map tiles are small 256 x 256 pixel images that are "tiled" together in a grid like fashion. They are broken up this way so that only the part of the earth you are viewing needs to be rendered. Only the images inside and just outside the map area you are looking at are being rendered. The server is told to render neighboring tiles and to cache them so that when you pan to a new area the interaction appears seamless.
We can overlay custom data on our web maps and even analyze geospatial data with CartoDB. This is where the fun comes in :)
PostGIS is the open-source technology that allows for doing geospatial analysis in CartoDB. Why would we want to use this over other types of GIS software?
- Replicable - you can script your workflow, which is great for leaving a trail of your work.
- It builds on SQL - if you already know SQL, this is an easy way to get into doing GIS analysis.
- You can query data dynamically - if you have a server that can crunch a PostGIS query and return JSON, you can do dynamic spatial queries in your apps. e.g. "Find me all points near me."
If you are interested you can find an introductory tutorial about using PostGIS in CartoDB here.
-
Create a free account and log into CartoDB. In the dashboard, select the
public data
option thenpopulated places
and add the dataset to your account. Take a look at theadm0cap field
in the table view dashboard. -
Walk through the GUI:
- There are ways to view your data in CartoDB:
- Table View: shows column names & rows, like Excel. Each row represents a point. SQL console.
- Show what's inside cells in
the_geom
column: lat and lon coordinates. - Map View: Allows for zooming and panning, changing the base map, using the side bar Wizard to style data.
- In the style wizard try switching data style to category view, choose the
adm0cap
column and assign markers toadm0cap
for country-capital vs. regular populated place - mention you can load custom images for markers
-
Demonstrate publishing:
- By clicking on the
Visualize
button we can create aVisualization
and share our map with the world via a URL, iframe or viz.json. - Note: any changes we make to our visualization will be updated in real time!
- Notice the differnces between the tables and visualizations dashboards. The former is just the data you have imported to your account, the latter are the maps you create with your data and may share / publish. Visualizations may link to multiple tables in the form of layers.
- By clicking on the
-
Delete the populated places dataset and visualization we made as we'll need the storage space for the free account.
-
Import the U.S. counties data from the URL:
http://acdmy.org/d/counties.zip
-
Take a look at what the values are inside the cells in
the_geom
column. -
Now switch to the map view to see how the polygons overlayed on U.S.
- try changing the base map.
- try changing the polygon fills and borders.
-
Demo info windows
- turn on /off columns.
- change style of info windows.
- mention you can customize them with HTML.
-
Demo Choropleth map with
pop
column- important: mapping population by county gives a false impression, we need to use population density.
- Let's normalize the data: divide number of people by area to have a normalized value to compare.
- SQL:
SELECT pop_sqkm, round( pop / (ST_Area(the_geom::geography)/1000000)) as psqkm FROM us_counties
- Use this tornado data:
http://acdmy.org/d/tornadoes.zip
- Inspect data & convert columns damage to number and date to date format (because CSV)
- Demo Wizard to show types of viz like Bubble Map, intensity, density map
- Add labels
- Data Filtering, show how this gets translated to SQL.
- Use the tornado data from above:
http://acdmy.org/d/tornadoes.zip
- Demo Torque option in the visualization wizard.
Combine datasets from last parts
- CartoDB Map Academy. What we did today comes from here.
- Intro to using PostGIS with CartoDB by Michael Keller
- Search GIS StackExchange using the tags
cartodb
and/orpostgis
.
- CartoDB Map Gallery
- Andrew Hill's maps
- CDB team maps 1
- CDB team maps 2
- Natural Earth Data: (3 levels of small-scale, world coverage) http://www.naturalearthdata.com/
- Metro Extracts: (OSM extracts of urban areas converted to shape�le and other formats) http://metro.teczno.com/
- Geofabrik (Continental & Country OSM extracts): http://download.geofabrik.de/
- OpenStreetMapData.com (OSM Land, Water, Coastline data): http://openstreetmap-data.com/data
- Open Data NYC: https://nycopendata.socrata.com/
- US National Weather Service (NOAA): http://www.nws.noaa.gov/geodata/
- U.S. Census: http://www.census.gov/2010census/data/