let data = {features: [],
type: 'FeatureCollection'
}
area.forEach((item, index) => {// console.log(item)
let color = ''if (item.attrMap[' 业主方 '] ==='1111') {color = 'blue'} else if (item.attrMap['业主方'] === '2222') {color = 'red'} else if (item.attrMap['业主方'] === '3333') {color = '#00ff8a'} else if (item.attrMap['业主方'] === '4444') {color = '#855CA4'} else {color = '#855'}
data.features.push({
geometry: {coordinates: [item.pointsArr],
type: 'Polygon'
},
properties: {
description: item.description ? item.description : '',
markerLatLng: item.pointsArr[0],
color:color
},
id: index,
type: 'Feature'
})
})
let layer = new PolygonLayer({zIndex: 2})
.source(data)
.color('color',(type)=>{return type})
.shape('fill')
.active(true)
.style({opacity: 0.35})