CartoCSS Filters过滤器基本语法
来源:互联网 发布:java封装的概念 编辑:程序博客网 时间:2024/05/17 07:55
CartoCSS in Mapbox Studio Classic
整理源自该页面:
https://www.mapbox.com/help/cartocss-in-studio
Styling data layers
- By layer ID
#layer_name { // styles}#layer_1,#layer_2 { // styles will apply to all the objects in both layers}
- By layer class
.roads { // styles will apply to all layers // with a class of 'roads'}
- Filter selectors
#road[class='motorway'] { line-join: round; line-color: #800, 75;}
- Zoom level filters
.roads { // styles will apply to all layers // with a class of 'roads'}
- By layer class
.roads { // styles will apply to all layers // with a class of 'roads'}
- Zoom level filters
Restrict styles to certain zoom levels:
#layer[zoom=0]{}
You can specify ranges of zoom levels using two filters:
#layer[zoom>=4][zoom<=10] { }
You can nest filters to better organize your styles:
#layer[zoom>=4][zoom<=10] { line-color: red; line-width: 2; [zoom=8] { line-width: 3; } [zoom=9] { line-width: 4; } [zoom=10] { line-width: 5; }}
- Numeric value comparision filters
You could create a style that only labels citites with a population
of more than 1 million:
#cities[population>1000000] { text-name: [name]; text-face-name: 'Open Sans Regular';}
You could also combine multiple numeric filters with zoom level filters to gradually bring in more populated cities as you zoom in.
#cities { [zoom>=4][population>1000000], [zoom>=5][population>500000], [zoom>=6][population>100000] { text-name: [name]; text-face-name: 'Open Sans Regular'; }}
As with zoom levels, you can select data based on numeric ranges.
#cities[population>100000][population<2000000] { }
- Text comparsion filters
You can also filter columns that contain text:
#roads { [class='motorway'] { line-width: 4; } [class='main'] { line-width: 2; } [class='street'] { line-width: 1; }}
You can also use the != (“not equal”)
operator in the filter:
#roads[class!='motorway'] { }
- Regular expression filters
#roads[class=~'motorway.*'] { }
0 0
- CartoCSS Filters过滤器基本语法
- 过滤器filters
- 过滤器filters
- Output Filters输出过滤器
- Hibernate 过滤器(filters)
- Hibernate 过滤器(filters)
- syslog-ng filters(过滤器)
- 内联过滤器Inline Filters
- MVC 过滤器(Filters)
- AngularJS过滤器(Filters)
- Bloom Filters布鲁姆过滤器
- Vue filters过滤器
- vue filters过滤器使用
- fiddler-filters过滤器
- 属性过滤器(Attribute Filters)
- 配置过滤器(Configuring Filters)
- JSP过滤器(Filters)精要
- CSS过滤器(CSS filters)
- 单链表的实现
- 获取未安装的App信息
- Java String.split用法小结
- 测测
- 嵌入式Linux学习-----u-boot移植
- CartoCSS Filters过滤器基本语法
- 在Apache+mod_wsgi+python的基础上搭建https安全访问
- iOS_字符串显示不同颜色
- Redis用户登录场景
- Python编程(二):Python进程、线程的那点事儿
- Http协议概述
- 行为型:设计模式之访问者模式(二十三)
- 用流域和最佳的阈值进行慢性淋巴细胞性白血病细胞分割
- 工厂设计模式