How to use CARTO BUILDER analysis to create insightful map applications

Last Thursday CARTO released BUILDER, its new geospatial web application, for new signup users. There are several new amazing features such as widgets (dynamic filters), styling with Turbo Carto (a CartoCSS preprocessor) and version control (save/update). But my favorite is the possibility of adding geospatial analysis to layers.

Connect with lines

In this blog post, I am going to create a map application (with a visualization as the screenshot above), showing just a couple of analysis that BUILDER can offer.

In this map, our intention is to connect the most populated cities to its country centroid. Connecting dots, making lines, creating track paths were one of the most common operation CARTO users have been doing. PostGIS allows you to do this. What is more, in order to make more realistic connections, you can design great circles. BUILDER implements all of these behind the scenes. You do not need to care about SQL anymore.

But before starting making lines, we need to create a new map and add world_borders layers and ne_10m_populated_places_simple datasets, both can be found in CARTO Data Library. After renaming the title and layer names (a good practice), we are going to add our first analysis to the world borders layer: “Find centroids to geometries”. In doing, so we are going to transform from polygons to points. You can set all parameters as shown in the screenshot below:


Right now you will not be able to distinguish between the centroids and the populated places layer. But do not worry, we will style everything later. Time to connect each city to its country centroid. To achieve this, you need to add “Connect with lines” analysis to the populated places layer. Take good notice of the following screenshot and set the input parameters accordingly.


Cool! Now it is time to make our visualization insightful but also pretty. First, remove the basemap and set a fix color, black is OK (#000000). Secondly, disable the view of the centroid (world borders) layer. Third, click on the lines (populated places) layer, select STYLE and as explained in this blog post, color the lines based upon the total population (pop_max).


The legend will be automatically generated*. You can edit it, thus renaming and adding prefixes and/or suffixes. Finally, we are going to add some widgets. Click on DATA and select point count, name and adm0name because we want to be able to filter by city and country name, knowing how many lines the visualization is displayed.

A quick look at the final result can give you some interesting insights. Brighter lines can be found in India and China as expected, Britain and France are connected with some isolated old overseas colonies, there is almost no lines over the Sahara dessert… Try to filter using widgets! You will get more and better insights!

*According to the legend, the pop_max minimum value is -99. This is a error originated by the populated places dataset. In order to solve this issue, you can use the “Filter by column value” analysis or just type SELECT * FROM ne_10m_populated_places_simple WHERE pop_max > 0.

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 *