arcgis for js 等级着色

1.根据发布的数据设置多种symbol样式

let less35 = {
  type: "simple-fill", // autocasts as new SimpleFillSymbol()
  color: "#38627a",
  style: "solid",
  outline: {
    width: 0.2,
    color: [255, 255, 255, 0.5]
  }
}
let less36 = {
  type: "simple-fill", // autocasts as new SimpleFillSymbol()
  color: "#FF66CC",
  style: "solid",
  outline: {
    width: 0.2,
    color: 'red'
  }
}

2.创建一个renderer,设置关键id(就是根据哪个字段进行分等级,我这里选择的是OBJECTID_1),接入之前创建样式并且根据值分等级

let render2 = {
  type:'class-breaks',
  field: "OBJECTID_1",
  classBreakInfos: [
    {
      minValue: 0,
      maxValue: 1000,
      symbol: less35,
      label: "< 35%" // label for symbol in legend
    },
    {
      minValue: 1000,
      maxValue: 2000000.3499,
      symbol: less36,
      label: "< 35%" // label for symbol in legend
    }
  ]
}

3.于featureLayer中使用,不知道的可以看我另外的文章

layerValue = new FeatureLayer({
    renderer:render2,
    id: "tempLyasdr",
    url:
      "http://*****:6080/arcgis/rest/services/*****/ShpDynamicWorkspace/MapServer/dynamicLayer",
    dynamicDataSource: {
      type: "data-layer",
      dataSource: {
        type: "table",
        workspaceId: "*****",
        // dataSourceName: "*****.shp",
      },
    },
});

4.原作者链接


友人A
81 声望11 粉丝