Last active
December 23, 2015 01:59
-
-
Save ccabanero/6563471 to your computer and use it in GitHub Desktop.
CartoCSS - examples so I don't forget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*---------------------------------------- | |
Examples for styling POLYGONS | |
----------------------------------------*/ | |
#countries { | |
::outline { | |
line-color: #85c5d3; | |
line-width: 2; | |
line-join: round; | |
} | |
polygon-fill: #fff; | |
} | |
/*---------------------------------------- | |
Examples for styling POLYLINES | |
----------------------------------------*/ | |
/* solid line */ | |
#street { | |
line-color:rgba(137,205,002,1); | |
line-width:10; | |
} | |
/* dashed line */ | |
#street { | |
line-color:rgba(205,245,122,1); | |
line-width:6; | |
line-dasharray:10,10; | |
} | |
/* scale-dependent rendering - styling features based on attribute and zoom level */ | |
#street[zoom<=14][CLASS_CODE=0] { | |
line-color:rgba(205,245,122,1); | |
line-width:2; | |
line-dasharray:10,10; | |
} | |
#street[zoom>=15][CLASS_CODE=0] { | |
line-color:rgba(205,245,122,1); | |
line-width:6; | |
} | |
#street[zoom<=14][CLASS_CODE=1] { | |
line-color:rgba(137,205,002,1); | |
line-width:4; | |
} | |
#street[zoom>=15][CLASS_CODE=1] { | |
line-color:rgba(137,205,002,1); | |
line-width:10; | |
} | |
/* compound line styles */ | |
#roads[Type='Major Highway'] { | |
::case { | |
line-width: 5; | |
line-color:#d83; | |
} | |
::fill { | |
line-width: 2.5; | |
line-color:#fe3; | |
} | |
} | |
/*---------------------------------------- | |
Examples for styling POINTS | |
----------------------------------------*/ | |
#point { | |
marker-width:10; | |
marker-fill:#f45; | |
marker-line-color:#813; | |
marker-allow-overlap:true; | |
} | |
/*---------------------------------------- | |
Examples for styling RASTERS | |
----------------------------------------*/ | |
#hillshade.hillshade { | |
raster-opacity:1; | |
raster-scaling:bilinear; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment