the kdmcinfo weblog

First look at CartoDB 1.0 data mapping platform

Just spent a couple of hours looking through CartoDB, an open source, cloud-based data mapping platform that was introduced at Google's Where conference last night.  CartoDB seems impressive for a 1.0 version. It's makes mapping easy for beginners and offers increasing functionality for those with more technical prowess. The example below shows releases of toxic chemicals in Alameda County, California and took about five minutes to make.

For the beginner

CartoDB has done a great job of making the simple tasks easy to do. Uploading data to create an embeddable map is fairly straight forward and takes just a few minutes. 

If you have a spreadsheet (Excel, CSV, or even a GPS eXchange Format) with longitude or latitude you can simply drag the file to your dashboard and CartoDB creates a database.

upload files


CartoDB then creates a table that you can filter or edit. 

Table example


Click on the map tab and your map markers are plotted automatically. If your spreadsheet contains additional columns of data, you can customize the size of the markers based on the value for each location as I did here and in the embedded map above.

custom bubbles


Spreadsheets with addresses can be geocoded but it requires a little work. But don't worry, it isn't hard — simply type in the columns you want to use as shown below. 

 Geocode data


Finally, click the Share This Map button and you get a window where you can adjust the zoom level and get an embed code. 

embed code


Working with boundary files

Many map files, like ZIP Codes or census tracts, are polygons. And CartoDB can handle most of these specific map formats including ESRI SHP files, Google's KML files, Open Street Map and GeoTIFF.  

Uploading one of these files works the same way, simply drag the files onto your dashboard and voila! You get a database and a corresponding map. 

You can then click on the map tab and adjust the colors to get a thematic map.

Thematic Map


Probably the biggest drawback for beginners will be the lack of an easy way to join a secondary data file with a map file.

What's that mean? Let's imagine that you have a map file of ZIP Code boundaries and you want to add some demographic data to your map. CartoBD does not allow you to do that from the browser. 

As a result, any data that you want to display in the map must already be part of the file or needs to be joined to it in another program. There are a host of free and open source programs that allow you to do this, including QGIS, geocommons and IndieMapper.

The other, more difficult option is to use the CartoDB APIs. Here's a tutorial so you can see what's required.


Using the Carto language

Once you have data in your boundary map, you can create color-coded thematic maps using the default customizations or you can use the Carto language.

Carto is essentially CSS for maps and is part of the free TileMill package from MapBox. I won't get into it here but if you've used CSS you'll pick it up in about five seconds.  Here's an example of the Carto editor:

carto editor


Powerful APIs for propeller heads

The best parts of CartoDB are the APIs.  It's here that a little programming knowledge goes a long way.  With the SQL API, you can use standard SQL statements in a URL to retrieve your data. If you prefer to use jQuery, GET and POST requests are supported. You can also create complex queries that use multiple tables.

Requests are returned in the JavaScript Object Notation (JSON) so they can easily be manipulated with JavaScript. You can also request GeoJSON (JSON with geographic coordinates included). 

CartoDB also offers a MapsAPI (an extension of the SQL API)  that allows visualization based on requests. You can use the API to change your vectors to a range of tiles for faster loading, include an SQL request and specify Carto styles at the same time. You can even integrate with Google Maps.

But by far one of my favorite features is the ability to change projections. If you know your projection ID number, it's this simple:

http://{account} ST_Transform(the_geom,4147) FROM {table_name}

In this case 4147 is  Hanoi 1972 (EPSG:4147) projection. Simply replace that with your preferred projection ID.

This robust API is what set's CartoDB apart from similar offerings like MapBox

CartoDB also distinguishes itself through it's API and it's large range of dynamic queries.


CartoDB is available as an open source project so anyone can download and hack. It also sells hosting and support as a service. There is a free plan that is limited to 5 public tables. Paid plans range from $29 to $149 per month and tables can be private.

The pricing is pretty reasonable for many organizations but cash-strapped companies or solo publishers may have to look for free alternatives. 

In many ways CartoDB is similar to the MapBox platform. But where MapBox charges for bandwidth, CartoDB pricing limits the number of maps you can store. 

It's an interesting byproduct of the open-source world that CartoDB will ingest and publish MapBox's TileMill files. According to CartoDB's Carlos Martinez, "both teams are highly supportive and keen contributors to each others products."

What I didn't cover

There are a lot of features that I didn't cover here, including Google Map integration, libraries in different programming languages, authentication and analysis tools.

You can see the Version 1.0 announcement from CartoDB on its blog and several tutorials are available on it's Vimeo channel.

Len De Groot is the Interactive Design and Data instructor for KDMC at UC Berkeley. He teaches in the Graduate School of Journalism and will lead a Data Mapping for Beginners workshop on July 23, 24 that is open to the public.