WebStyleSymbol (2D)

尝试一下在线预览

WebStyleSymbol 可用于设置 FeatureLayer 和 GraphicsLayer 的样式。

此示例演示如何使用 2D MapView 中的 UniqueValueRenderer 使用 2D Web 样式符号设置要素图层的样式。

下面的代码片段创建了一个包含 25 个符号名称的数组,将在示例中使用。符号名称是 2D Web 样式符号 中的知名名称。然后,它遍历符号名称并在要素图层的 UniqueValueRenderer 上创建一个值——符号对数组作为 uniqueValueInfos

                                       
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const symbolCats = [
  "post-office",
  "atm",
  "place-of-worship",
  "park",
  "school",
  "hospital",
  "fire-station",
  "playground",
  "shopping-center",
  "campground",
  "golf-course",
  "library",
  "city-hall",
  "beach",
  "police-station",
  "subway-station",
  "train-station",
  "cemetery",
  "trail",
  "radio-tower",
  "museum",
  "airport",
  "live-music-venue",
  "sports-complex",
  "ferry"
];

rendererInfos = symbolCats.map((symCat) => {
  return {
    value: symCat,
    symbol: {
      type: "web-style",
      name: symCat,
      styleName: "Esri2DPointSymbolsStyle"
    },
    label: symCat
  };
});

更多可在 2D MapView 中使用的开箱即用的 web 样式符号可以在引导页 GeoScene Web 样式符号(2D)中找到。

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.