优化mapQueryService查询逻辑,加快响应

This commit is contained in:
JIANG
2025-12-31 15:23:13 +08:00
parent f137883e4c
commit 3255108d96

View File

@@ -479,12 +479,16 @@ const handleMapClickSelectFeatures = async (
// 如果要素来自 VectorTileSource需要通过 WFS 查询完整信息 // 如果要素来自 VectorTileSource需要通过 WFS 查询完整信息
const queryId = firstFeature.getProperties().id; const queryId = firstFeature.getProperties().id;
const layerName = firstFeature.getProperties().layer;
if (layerName === "geo_pipes" || layerName === "geo_junctions") {
layerName.concat("_mat");
}
if (!queryId) { if (!queryId) {
return null; return null;
} }
try { try {
const features = await queryFeaturesByIds([queryId]); const features = await queryFeaturesByIds([queryId], layerName);
return features[0] || null; return features[0] || null;
} catch (error) { } catch (error) {
console.error("查询要素详情失败:", error); console.error("查询要素详情失败:", error);