I have a set of field measurements for a bird species (pitch of its song) along with coordinates for each measurement.

The default choropleth style in CARTO works perfectly for showing how the pitch varies across its geographic distribution (see image; red means higher pitch). However, many of my data points overlap. How can I cluster them together and display the average pitch for overlapping points in choropleth-style?

Pitch of bird song from high (red) to low (yellow).

1 Answer 1


Please follow these steps in order to create a choropleth map clustering and aggregating closer points by averaging some numeric field with Torque in BUILDER:

1-First, create a map with a point dataset. For this example, I am going to use ne_10m_populated_places_simple dataset from CARTO Data Library.

2-Secondly, go to the STYLE tab and select ANIMATED from the Aggregation section.

3-Third, ope the CartoCSS console and apply the following CartoCSS code:

Map {
  -torque-frame-count: 1;
  -torque-animation-duration: 0;
  -torque-time-attribute: "cartodb_id";
  -torque-aggregation-function: "avg(pop_max)";
  -torque-resolution: 12;
  -torque-data-aggregation: cumulative;
#layer {
  marker-width: 5;
  marker-fill: #fcde9c;
  marker-fill-opacity: 0.9;
  marker-line-width: 1;
  marker-line-color: #000;
  marker-line-opacity: 1;
#layer[value > 50000]{ 
#layer[value > 100000]{ 
#layer[value > 200000]{ 
#layer[value > 300000]{ 
#layer[value > 400000]{ 
#layer[value > 500000]{ 

You would only need to change the argument of the torque-aggregation-function and maybe the torque-resolution depending on how your points are spatially distributed. I have also selected a color palette from CARTOcolors.

4-Finally, remove the time series widget that has been automatically generated and add a custom legend. You should end up with a map similar to this one:



If you want to know more about the potential of Torque, this old blogpost is the place. :-)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.