-
Notifications
You must be signed in to change notification settings - Fork 7
Example Maps
Mamata Akella edited this page Jul 26, 2016
·
12 revisions
Awesome examples go here!
- In the example below, we want to highlight any point categorized as
Private roomwith red and color everything else gray to do this, we'll use themarker-fillproperty

#layer {
marker-fill-opacity: 0.9;
marker-line-color: #fff;
marker-line-width: 1;
marker-line-opacity: 1;
marker-placement: point;
marker-type: ellipse;
marker-allow-overlap: true;
marker-width: 7;
marker-fill: ramp([room_type],(gray,red),("Private room"));
}
- In the map below, we are using
marker-width,marker-fill, andmarker-line-widthto reinforce larger and smaller magnitude earthquakes. For each style property, we are using themagattribute with manually defined class breaks>-=to1,2,3,4,5,6,7,8
#layer {
marker-fill: ramp([mag],cartocolor(SunsetDark),(1,2,3,4,5,6,7,8),>=);
marker-width: ramp([mag],range(5,15),(1,2,3,4,5,6,7,8),>=);
marker-fill-opacity: 0.9;
marker-line-color:#fff;
marker-line-width: ramp([mag],range(0.5,2),(1,2,3,4,5,6,7,8),>=);
marker-line-opacity: 1;
marker-placement: point;
marker-type: ellipse;
marker-allow-overlap: true;
}
- In the map below, we have manually defined 7 classes and are using the
mappingproperty>=which is greater than or equal to
- uses
polygon-opacityto ramp transparency from a starting color

#demographics_sf [white_pop != null] {
::asian {
polygon-fill: mediumvioletred;
polygon-opacity: ramp([asian_pop],0,0.9,(0.1,.34,.67,.90),>=);
}
::hispanic {
polygon-fill: teal;
polygon-opacity: ramp([hispanic_pop],0,0.9,(0.1,.34,.67,.90),>=);
}
::black {
polygon-fill: darkorange;
polygon-opacity: ramp([black_pop],0,0.9,(0.1,.34,.67,.90),>=);
}
::white {
polygon-fill: #000;
polygon-opacity: ramp([white_pop],0,0.9,(0.1,.34,.67,.90),>=);
line-color: #fff;
line-width: 0.25;
line-opacity: 0.25;
polygon-gamma: 0.5;
line-comp-op: soft-light;
}
}

https://team.carto.com/u/mamataakella/builder/84984356-502f-11e6-9205-0ecd1babdde5/embed
#layer {
marker-width: ramp([dn], 5, 8, quantiles,7);
marker-fill:#777f7f;
marker-fill-opacity: 0.8;
marker-allow-overlap: true;
marker-line-width: 0;
marker-line-color: #fff;
marker-line-opacity: 1;
[zoom<=2]{marker-width: 2.5;}
[zoom=3]{
marker-width: ramp([dn], 2, 4, quantiles,7);
}
[zoom>=6]{
marker-width: ramp([dn], 10, 16,quantiles,7);
}
}

https://team.carto.com/u/mamataakella/builder/962c2922-5014-11e6-8c58-0e05a8b3e3d7/embed
#layer {
marker-width: 3.5;
marker-allow-overlap: true;
marker-line-width: 0;
marker-line-color: #ffda8d;
marker-line-opacity: 1;
marker-fill:
ramp([dn],
(
#23284e,
#273660,
#294570,
#2a557d,
#2b6588,
#2c768f,
#2f8794,
#339796,
#39a796,
#42b595,
#4ec294,
#5ecd93,
#70d794,
#84df97,
#9ae59d,
#b1eba7,
#c8efb6,
#ddf4ca,
#f0f8e2
)
);
[zoom<=2]{marker-width:2.5;}
[zoom>=4]{marker-width: 4.5;}
[zoom>=4]{marker-width: 5.5;}
}