个人偏好使用mapbox,但是架不住人多,被使用maptalks,然而的文档非常感人,让人泪崩三千里……
maptalks图形样式设置,通过symbol设置
设置symbol的,可以直接在 图形(Marker LineString Polygon ),Geometry、VectorLayer 设置
maptalks矢量图形 geoJSON形式有marker(point)/LineString/Polygon,Geometry
如果新建标志marker,设置option.symbol参数
var marker = new Marker([100, 0], {
'id' : 'marker0',
'symbol' : {
'markerFile' : 'foo.png',
'markerWidth' : 20,
'markerHeight': 20,
},
'properties' : {
'foo' : 'value'
}
});
marker.setSymbol(symbol)
symbol在官方文档,一下子都找不到相关参数,坑货。搞了大半天才从GitHub上面找symbol具体属性
https://github.com/maptalks/maptalks.js/wiki/Symbol-Reference#all
Marker | Text | Polygons and Lines |
---|---|---|
markerOpacitymarkerWidthmarkerHeightmarkerDxmarkerDymarkerHorizontalAlignmentmarkerVerticalAlignmentmarkerPlacementmarkerRotationmarkerFilemarkerTypemarkerFillmarkerFillPatternFilemarkerFillOpacitymarkerLineColormarkerLineWidthmarkerLineOpacitymarkerLineDasharraymarkerLinePatternFilemarkerPathmarkerPathWidthmarkerPathHeight | textPlacementtextFaceNametextFonttextWeighttextStyletextSizetextFilltextOpacitytextHaloFilltextHaloRadiustextHaloOpacitytextWrapWidthtextWrapCharactertextLineSpacingtextHorizontalAlignmenttextVerticalAlignmenttextAligntextRotationtextDxtextDy | lineColorlineWidthlineDasharraylineOpacitylineJoinlineCaplinePatternFilelineDxlineDypolygonFillpolygonOpacitypolygonPatternFile |
这些规则可应用于:
Categories | Can be applied to |
---|---|
Marker | Markers, Polygons, Lines |
Text | Markers, Polygons, Lines |
Line | Polygons, Lines |
Polygon | Polygons |
HTML-style hex values, rgb, rgba, hsl, and hsla. Predefined HTML colors names, like yellow and blue, are also permitted.
Gradient color, like it in Canvas, can be either linear gradient color or radial gradient color, the form of gradient color is a JSON object with type, places and color stops:
maptalks批量设置样式,一般把其归类,设置规律的集合属性即可
MultiPoint、MultiLineString、MultiPolygon、MultiGeometry、GeometryCollection
https://maptalks.org/maptalks.js/api/0.x/MultiGeometry.html
这是和单个设置其实一样的,不必赘述
一般数据量多了,就通过分层 归集数据,这时候,设置VectorLayer 样式属性即可
layer.setStyle([
{
'filter': ['==', 'count', 100],
'symbol': {'markerFile': 'foo1.png'}
},
{
'filter': ['==', 'count', 200],
'symbol': {'markerFile': 'foo2.png'}
}
])
这种模式我用的最多
转载本站文章《maptalks点线面图形样式设置经验总结——symbol属性与方法》, 请注明出处:https://www.zhoulujun.cn/html/GIS/maptalks/2019_1118_8216.html
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有