leaflet版本9.1.2
用等级符号图渲染数据,主要代码如下
// 创建一个圆形符号专题图层
let symbolLayer = L.supermap.rankSymbolThemeLayer('SymbolLayer_' + id, SuperMap.ChartType.CIRCLE)
// 指定用于专题图制作的属性字段
symbolLayer.themeField = 'value'
let min = Math.min(...data.datas[num].segment_values)
let max = Math.max(...data.datas[num].segment_values)
// 配置图表参数
symbolLayer.symbolSetting = {
codomain: [min, max], // 允许图形展示的值域范围必设参数
maxR: range, // 圆最大半径 默认50
minR: 0, // 圆最小半径 默认0
circleStyle: { fillOpacity: 0.6 }, // 圆形样式
fillColor: color, // 符号专题图填充颜色
circleHoverStyle: { fillOpacity: 0.8 }// 专题图hover 样式
}
symbolLayer.addTo(map)
this.addThemeFeatures(data.datas[num].values, symbolLayer)
addThemeFeatures(values, layer) {
let valueTemp = {}
let regioninfos = []
for (let i = 0; i < values.length; i++) {
// 每一百个区划叠加一次,不一次性查询出来,村的边界数据太大
let regioncode = values[i].regioncode
let value = values[i].value
let regiontype = values[i].regiontype
valueTemp[regioncode] = value
let regionInfo = {
regioncode: regioncode,
regiontype: regiontype
}
regioninfos.push(regionInfo)
if (i > 0 && i % 100 === 0) {
this.queryFeatures(valueTemp, regioninfos, layer)
valueTemp = {}
regioninfos = []
}
}
if (valueTemp !== null && !$.isEmptyObject(valueTemp)) {
this.queryFeatures(valueTemp, regioninfos, layer)
}
},
queryFeatures(data, regioninfos, symbolLayer) {
let _that = this
let regiontype = regioninfos[0].regiontype
sgisSpatialQuery.spatialQueryUtil.getFeaturesByRegionCodes(
regioninfos,
regiontype,
function (serviceResult) {
let result = serviceResult.result
if (result && result.features) {
let features = result.features
// 重新构造一下features
for (let i = 0; i < features.features.length; i++) {
let code = features.features[i].properties.QH_CODE
features.features[i].properties['value'] = data[code]
}
let bounds = L.geoJSON(features).getBounds()
let map = sgisMapBase.getMap()
setTimeout(e => {
map.flyToBounds(bounds)
}, 1000)
let featuresNew = _that.polygonToPoint(features)
symbolLayer.addFeatures(featuresNew)
debugger
// eslint-disable-next-line no-undef
config.loading.close()
}
}
)
},
专题图也加到了map中 所有的数据要素features也加到了专题图中 但是地图上没有显示,,可能是什么问题?