在 Mapbox 中使用 MultiLineString 样式属性

问题描述 投票:0回答:0

我正在使用

MultiLineString
功能和
properties
对象,为
MultiLineString
中的每个项目定义颜色。例如:

多行字符串

{
  "type": "FeatureCollection",
  "features": {
    "type":"Feature",
    "properties": {
      "lineProperties":[
        {"color":"#FF6600"},
        {"color":"#6600FF"},
        {"color":"#00FF00"}
      ]
    },
    "geometry": {
      "type": "MultiLineString",
      "coordinates": [
        [],
        [],
        []
      ]
    }
  }
}

映射时,我想根据

coordinates
的索引应用颜色。例如,第一个
coordinates
字符串将应用
#FF6600
,因为它是
lineProperties
数组中的第一个。

是否可以使用Mapbox表达式根据索引进行匹配?

mapbox mapbox-gl-js
© www.soinside.com 2019 - 2024. All rights reserved.