优化mapQueryService查询逻辑,加快响应
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user