个人偏好使用mapbox,但是架不住人多,被使用maptalks,然而的文档非常感人,让人泪崩三千里……

maptalks图形样式设置,通过symbol设置

设置symbol的,可以直接在 图形(Marker LineString Polygon ),Geometry、VectorLayer 设置

单个图形设置样式:

maptalks矢量图形 geoJSON形式有marker(point)/LineString/Polygon,Geometry

在新建时通过option.symbol设置

如果新建标志marker,设置option.symbol参数

var marker = new Marker([100, 0], {
    'id' : 'marker0',
    'symbol' : {
        'markerFile'  : 'foo.png',
        'markerWidth' : 20,
        'markerHeight': 20,
    },
    'properties' : {
        'foo' : 'value'
    }
});

通过setSymbol updateSymbol方法设置

marker.setSymbol(symbol)

symbol属性列表

symbol在官方文档,一下子都找不到相关参数,坑货。搞了大半天才从GitHub上面找symbol具体属性

https://github.com/maptalks/maptalks.js/wiki/Symbol-Reference#all

Marker Text Polygons and Lines
  • markerOpacity

  • markerWidth

  • markerHeight

  • markerDx

  • markerDy

  • markerHorizontalAlignment

  • markerVerticalAlignment

  • markerPlacement

  • markerRotation

  • markerFile

  • markerType

  • markerFill

  • markerFillPatternFile

  • markerFillOpacity

  • markerLineColor

  • markerLineWidth

  • markerLineOpacity

  • markerLineDasharray

  • markerLinePatternFile

  • markerPath

  • markerPathWidth

  • markerPathHeight

  • textPlacement

  • textFaceName

  • textFont

  • textWeight

  • textStyle

  • textSize

  • textFill

  • textOpacity

  • textHaloFill

  • textHaloRadius

  • textHaloOpacity

  • textWrapWidth

  • textWrapCharacter

  • textLineSpacing

  • textHorizontalAlignment

  • textVerticalAlignment

  • textAlign

  • textRotation

  • textDx

  • textDy

  • lineColor

  • lineWidth

  • lineDasharray

  • lineOpacity

  • lineJoin

  • lineCap

  • linePatternFile

  • lineDx

  • lineDy

  • polygonFill

  • polygonOpacity

  • polygonPatternFile

这些规则可应用于:

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.

  • lineColor: "#ff0",

  • lineColor: "#ffff00",

  • lineColor: "rgb(255, 255, 0)",

  • lineColor: "rgba(255, 255, 0, 1)",

  • lineColor: "hsl(100, 50%, 50%)",

  • lineColor: "hsla(100, 50%, 50%, 1)",

  • lineColor: "yellow"

渐变色设置和canvas设置一样

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:

通过Geometry设置图形样式

批量设置样式

maptalks批量设置样式,一般把其归类,设置规律的集合属性即可

multi集合设置

MultiPoint、MultiLineString、MultiPolygon、MultiGeometry、GeometryCollection

https://maptalks.org/maptalks.js/api/0.x/MultiGeometry.html

这是和单个设置其实一样的,不必赘述

通过VectorLayer设置

一般数据量多了,就通过分层 归集数据,这时候,设置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

maptalks点线面图形样式设置经验总结的更多相关文章

  1. Analyzer使用第二Y轴,以及同一分析图不同量值使用不同的图形样式

    Analyzer的建立分析图后,图中有两个量值,希望能显示成不同的图形样式,如一个是柱图.一个是线图. 1.设置显示多个量值: 3.设置显示出图例,即表明图中量值内容的说明: 2.右键图例中要修改为不 ...

  2. SVG基本形状及样式设置

    前面的话 图形分为位图和矢量图.位图是基于颜色的描述,是由像素点组成的图像:而矢量图是基于数学矢量的描述,是由几何图元组成的图像,与分辨率无关.可缩放矢量图形,即SVG,是W3C XML的分支语言之一 ...

  3. CSS样式设置语法全解,样式优先级、值和单位、字体、文本、块级元素,行内元素,替换元素、非替换元素、display、float、position、table、li、光标、边距边框、轮廓、颜色背景

    全栈工程师开发手册 (作者:栾鹏) 一个demo学会css css选择器全解 css操作语法全解 CSS样式设置语法全解: 样式优先级 1. !important标记的样式 > 内联样式(sty ...

  4. js学习进阶-元素获取及样式设置

    var imgs = document.querySelectorAll("article img"); 获得article元素的直接或间接子孙的所有img元素, <arti ...

  5. placeholder的样式设置

    在input框中有时想将输入的字和placeholder设为不同的颜色或其它效果,这时就可以用以下代码来对placeholder进行样式设置了. ::-webkit-input-placeholder ...

  6. Asp.Net中应用Aspose.Cells输出报表到Excel 及样式设置

    解决思路: 1.找个可用的Aspose.Cells(有钱还是买个正版吧,谁开发个东西也不容易): 2.在.Net方案中引用此Cells: 3.写个函数ToExcel(传递一个DataTable),可以 ...

  7. Fair Scheduler 队列设置经验总结

    Fair Scheduler 队列设置经验总结 由于公司的hadoop集群的计算资源不是很充足,需要开启yarn资源队列的资源抢占.在使用过程中,才明白资源抢占的一些特点.在这里总结一下. 只有一个队 ...

  8. 导出Excel之Epplus使用教程2(样式设置)

    导出Excel之Epplus使用教程1(基本介绍) 导出Excel之Epplus使用教程2(样式设置) 导出Excel之Epplus使用教程3(图表设置) 导出Excel之Epplus使用教程4(其他 ...

  9. PowerDesigner的样式设置

    原文:PowerDesigner的样式设置 PD提供了强大的配置功能,可以对生成的数据库对象命名.数据模型的展现进行设置.这里首先讲下样式的设置. 颜色和字体设置 1.单独设置某个对象的颜色和字体 1 ...

  10. POI Excel导出样式设置

    HSSFSheet sheet = workbook.createSheet("sheetName");    //创建sheet sheet.setVerticallyCente ...

随机推荐

  1. CSP2021游记

    题外话 中午十二点半到了考场.没到时间不让进,恰巧发现 lhm 在对面饭店于是去讨论了一下上午 J 组的题,复习了线段树板子( 等到进考场坐好的时候已经两点半了,看考号本来以为我们同机房三个同学会坐一 ...

  2. Android WebAPIOperator

    package com.example.myapplication2.models.CommonClasses; import org.json.JSONObject; import java.io. ...

  3. C++快读、快写模版

    inline int read() { char ch = getchar(); int x = 0,f = 1; while (!isdigit(ch)) if (ch == '-') f = -1 ...

  4. Apollo 配置中心的部署与使用经验

    前言 Apollo(阿波罗)是携程开源的分布式配置管理中心. 本文主要介绍其基于 Docker-Compose 的部署安装和一些使用的经验 特点 成熟,稳定 支持管理多环境/多集群/多命名空间的配置 ...

  5. openwrt使用tailscale实现内网穿透

    问题 之前一直有电信公网ip,最近发现电信公网ip被撤下来了,打电话再去要发现给的是10开头的ip,电信客服还跟我说10开头就是公网ip,= =,根本就不是,无奈使用zerotier进行打洞,把zer ...

  6. [C++]vector的基本的用法

    [vector/容器/向量/动态数组]的基本的用法 容器的定义 向量/容器(Vector)是一个封装了动态大小数组的顺序容器(Sequence Container). 跟任意其它类型容器一样,它能够存 ...

  7. Kurator v0.5.0发布,打造统一的多集群备份与存储体验

    本文分享自华为云社区<Kurator v0.5.0正式发布! 打造统一的多集群备份与存储体验>,作者: 云容器大未来 . Kurator 是由华为云推出的开源分布式云原生套件.面向分布式云 ...

  8. Numpy理解

    目录 什么是numpy numpy的安装 numpy数组 定义numpy数组 numpy数组的相关功能 基本操作 0数组和1数组 随机数组 二维数组 numpy的数组操作 我们再平常学习python和 ...

  9. [ABC246G] Game on Tree 3

    Problem Statement There is a rooted tree with $N$ vertices, Vertex $1$ being the root. For each $i = ...

  10. springboot——入门案例

    真简单啊 springboot 学了入门案例,有感而发 首先是一个自带的配置文件: package com.example.springboot_01; import org.springframew ...