Skip to main content
100%

turbo-cartocss examples

✓ Published0🌍 Public
AAlan McConchie
Last edited Jun 15, 2016
Created on Jun 14, 2016

This interactive map demonstrates the `ramp()` function in CartoCSS, a styling language for CartoDB maps, through live-editable SQL and CartoCSS panels. Users can explore how color ramps (using ColorBrewer palettes) and numeric ramps (for marker width or opacity) can be applied to data columns, with options to control the number of data classes, quantification methods (quantiles, equal interval, jenks, and headtails), and bucket counts. The map, centered on Brazil, updates in real time as code is edited, showing the impact of different ramp configurations on point, line, and polygon styling. The interface includes a CodeMirror editor for both SQL and CartoCSS, an examples dropdown, and a customizable API endpoint, allowing users to experiment with different data and styling combinations.

AI-generated description

Color ramps: *-fill

Basic usage

marker-fill: ramp([column_name], colorbrewer(Greens));
                  |                    |
                  v                    |
      column to calculate ramp         |
                                       v
                it will use a color ramp from http://colorbrewer2.org/

Change number of color brewer data classes

marker-fill: ramp([column_name], colorbrewer(YlGnBu, 7));
                                                     |
                                                     v
                                          force number of classes
                                            default: 5 classes

Change quantification method

marker-fill: ramp([column_name], colorbrewer(Reds), jenks);
                                                      |
                                                      v
                                         force quantification method
                                             default: quantiles

Numeric ramps: *-width, *-opacity

Basic usage

marker-width: ramp([column_name], 4, 18);
                   |              |   |
                   v              |   |
       column to calculate ramp   |   |
                                  v   |
           start value for the ramp   |
                                      |
                                      v
                            end value for the ramp

Change quantification method

marker-width: ramp([column_name], 4, 18, equal);
                                           |
                                           v
                               force quantification method
                                    default: quantiles

Change number of buckets

marker-width: ramp([column_name], 4, 18, 6);
                                         |
                                         v
                              force number of buckets
                                    default: 5

Change both: number of buckets and quantification method

marker-width: ramp([column_name], 4, 18, 6, jenks);
                                         |    |
                                         v    |
                   force number of classes    |
                                              v
                                 force quantification method

Options

Quantification methods

Similar vizzes