|
|
@@ -62,7 +62,7 @@ onMounted(() => {
|
|
|
}
|
|
|
|
|
|
// 只加载乡镇级GeoJSON,并根据所属区县着色
|
|
|
- fetch('/data/韶关市乡镇划分图.geojson')
|
|
|
+ fetch('http://localhost:8000/api/vector/export/all?table_name=town&format=geojson')
|
|
|
.then(res => {
|
|
|
if (!res.ok) throw new Error(`乡镇划分图加载失败:${res.status}`);
|
|
|
return res.json();
|
|
|
@@ -70,7 +70,7 @@ onMounted(() => {
|
|
|
.then(townshipGeojson => {
|
|
|
L.geoJSON(townshipGeojson, {
|
|
|
style: (feature) => {
|
|
|
- const countyName = feature.properties.FXZQMC || '';
|
|
|
+ const countyName = feature.properties.county_name || '';
|
|
|
|
|
|
return {
|
|
|
fillColor: getDistrictColor(countyName), // 使用所属区县的颜色
|
|
|
@@ -82,7 +82,7 @@ onMounted(() => {
|
|
|
},
|
|
|
|
|
|
}).addTo(map);
|
|
|
- console.log('✅ 乡镇划分图加载完成,已按所属区县着色');
|
|
|
+ //console.log('✅ 乡镇划分图加载完成,已按所属区县着色');
|
|
|
})
|
|
|
.catch(err => {
|
|
|
console.error('❌ 乡镇划分图加载失败:', err);
|
|
|
@@ -102,7 +102,7 @@ onMounted(() => {
|
|
|
);
|
|
|
const geoJSONData = JSON.parse(fixedText);
|
|
|
|
|
|
- console.log('✅ 接口数据加载完成,共', geoJSONData.features.length, '条记录');
|
|
|
+ //console.log('✅ 接口数据加载完成,共', geoJSONData.features.length, '条记录');
|
|
|
|
|
|
let markerCount = 0;
|
|
|
geoJSONData.features.forEach((feature, idx) => {
|
|
|
@@ -143,7 +143,7 @@ onMounted(() => {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- console.log(`✅ 成功创建 ${markerCount} 个有效标记`);
|
|
|
+ //console.log(`✅ 成功创建 ${markerCount} 个有效标记`);
|
|
|
})
|
|
|
.catch(err => {
|
|
|
console.error('❌ 接口数据加载失败:', err);
|
|
|
@@ -153,7 +153,7 @@ onMounted(() => {
|
|
|
map.on('load', () => {
|
|
|
setTimeout(() => {
|
|
|
map.invalidateSize();
|
|
|
- console.log('✅ 地图尺寸已重新计算');
|
|
|
+ //console.log('✅ 地图尺寸已重新计算');
|
|
|
}, 300);
|
|
|
});
|
|
|
|