|
|
|
@ -201,32 +201,35 @@ export default { |
|
|
|
const polygon = [ |
|
|
|
...srcGridData.children |
|
|
|
.filter((item) => item.coordinates.length > 0) |
|
|
|
.map((item) => ({ |
|
|
|
type: "Feature", |
|
|
|
properties: { |
|
|
|
// id: item.id, |
|
|
|
// name: item.name, |
|
|
|
// level: item.level, |
|
|
|
center: [item.longitude, item.latitude], |
|
|
|
...item, |
|
|
|
dotCount: gridCountData.find((item2) => item2.orgId == item.id) |
|
|
|
? gridCountData.find((item2) => item2.orgId == item.id).total |
|
|
|
: "", |
|
|
|
}, |
|
|
|
geometry: { |
|
|
|
type: "Polygon", |
|
|
|
coordinates: [ |
|
|
|
item.latitude |
|
|
|
? [[item.longitude, item.latitude]] |
|
|
|
: spliceIntoChunks( |
|
|
|
item.coordinates |
|
|
|
.split(",") |
|
|
|
.map((item) => parseFloat(item)), |
|
|
|
2 |
|
|
|
).filter((item) => item.length == 2), |
|
|
|
], |
|
|
|
}, |
|
|
|
})), |
|
|
|
.map((item) => { |
|
|
|
let countItem = gridCountData.find( |
|
|
|
(item2) => item2.orgId == item.id |
|
|
|
); |
|
|
|
console.log("countItem", countItem); |
|
|
|
return { |
|
|
|
type: "Feature", |
|
|
|
properties: { |
|
|
|
...item, |
|
|
|
center: [item.longitude, item.latitude], |
|
|
|
dotCount: countItem |
|
|
|
? countItem.categoryName + ":" + countItem.total |
|
|
|
: "", |
|
|
|
}, |
|
|
|
geometry: { |
|
|
|
type: "Polygon", |
|
|
|
coordinates: [ |
|
|
|
item.latitude |
|
|
|
? [[item.longitude, item.latitude]] |
|
|
|
: spliceIntoChunks( |
|
|
|
item.coordinates |
|
|
|
.split(",") |
|
|
|
.map((item) => parseFloat(item)), |
|
|
|
2 |
|
|
|
).filter((item) => item.length == 2), |
|
|
|
], |
|
|
|
}, |
|
|
|
}; |
|
|
|
}), |
|
|
|
]; |
|
|
|
return { type: "FeatureCollection", features: polygon }; |
|
|
|
}, |
|
|
|
@ -496,7 +499,7 @@ export default { |
|
|
|
.source(polygonDotData) |
|
|
|
.color("name", styleConfig.textColor) |
|
|
|
.shape("dotCount", "text") |
|
|
|
.size(16) |
|
|
|
.size(14) |
|
|
|
.style({ |
|
|
|
textAnchor: "center", // 文本相对锚点的位置 center|left|right|top|bottom|top-left |
|
|
|
textOffset: [0, -80], // 文本相对锚点的偏移量 [水平, 垂直] |
|
|
|
|