Three cartography tricks for making CARTO BUILDER maps

Almost one year from last blog post, here we are again. Lots of things have happened since then. I would like to mention some key events such as CARTO Locations, SIGLibre (where I gave a talk about A series of unfortunate maps) and several GeoInquietos Madrid talks and workshops.

This time I will give you some easy tips to elaborate very useful artifacts with BUILDER STYLE UI but also switching to a more pro mode with CartoCSS. Before reading further, I will recommend to have a look at CARTO’s Styling Guides. They were written by Mamata Akella, the real expert here. But if you want to skip go through those guides, log into your CARTO account and follow the instructions below. In doing so, at the end of the day, you will be able to create outstanding visualizations in a manner of minutes displaying markers as beacons and fireflies among others.

How to convert markers into beacons

A very common use case in cartography is highlighting some elements to stand out from the rest. A traffic map showing accidents locations as intermittent markers could be a good example. I have learnt this trick from the people of Geographica. Basically, you need to create an animated map with just two steps. But let me show you how to do it step by step:

  1. 1-First, create a New Map connecting Roads dataset from the Data Library.
  2. 2-Add a new empty layer.
  3. 3-Rename them as “Roads” (instead of ne_10m_roads) and “Accidents” (I also recommend changing the dataset name to accidents). You can rename the map as well as “Roads and accidents”.
  4. 4-I have also filtered the roads, showing just the ones from North America. This (optional) step can be done with a simple SQL query like SELECT * FROM ne_10m_roads WHERE continent like 'North America'  or with the Filter by column value analysis.
  5. 5-Change the basemap from “Positron” to “Dark Matter Lite”.
  6. 6-Style the roads by type values.
  7. 7-Add some points to the “Accidents” layer using the Geometry edition tool.
  8. 8-Using the SQL panel in the DATA tab, we are going to duplicate our data adding to each row a new step value:
  9. 9-Create an animated map from the STYLE tab selecting the step column. Then set the DURATION and STEPS parameters to 2. After removing the time series widget, you should have a map similar to this one:

How to transform lines into lightsabers

I am huge fan of Star Wars, so when John Nelson publish this blogpost about transforming lines into lightsabers (I mean firefly lines), I quickly run to replicate it with CartoCSS. So we are going to follow his same tutorial but applying it within the CartoCSS console:

  1. 1-Create a New Map selecting world_border_hd dataset from the Data Library.
  2. 2-Rename both the layer and the dataset as “Countries” and “Lightsaber World Borders”.
  3. 3-Again, change the basemap to a dark one.
  4. 4-Go to the STYLE tab and switch to the CartoCSS panel. Replace the standard code with this one to make your lines glow:
  1. 5-Don’t forget to publish and share your map! You can apply the same trick with points (but you would need to use marker properties instead).

I used the same color bonanza palette as John applied, but you can use some of the amazing CARTOcolors schemes as well.

How to assign colors and numeric values to style properties

Imagine that you want to style your layer base upon a column value. Now you can do it thanks to the STYLE BY VALUE option in BUILDER. After applying this technique, if you are curious enough, switch to the CartoCSS panel. There you can check the code which convert UI options to choropleths, category and/or bubble maps. These are TurboCARTO ramp functions. TurboCARTO is great when you do not know about your data structure but also works perfectly when filtering by widgets in BUILDER.

But if you know your data, vanilla CartoCSS is enough (and sometimes recommended). In this last tutorial, I will show you another hidden trick: assigning values directly to a CartoCSS property. This time I have prepared a dataset for you. You can download it from this link. As you can see they are all the Madrid Metro lines with one string column added storing the color hexcodes for each line.

  1. 1-Create a New Map selecting the madrid_metro_lines dataset which we have previously imported.
  2. 2-Secondly, rename the map and layer as “Madrid Metro Lines” and “Lines” respectivaly.
  3. 3-Go to the STYLE tab and switch to the CartoCSS panel, and replacte the line-color value with [color].

Again, you can use the same technique with marker-width as explained here.

I would love to hear your comments about these techniques!

GIS Analyst. Working at @CARTO and @ongawa4d.

Leave a Reply

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *