Skip to content

Commit 5953000

Browse files
[update] 解决带token的wfs服务无法正常点选的问题
(review by ytt)
1 parent e11367d commit 5953000

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/mapboxgl/layer-highlight/LayerHighlightViewModel.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,9 @@ export default class HighlightLayer extends mapboxgl.Evented {
749749
private async getDatasetProjection(
750750
datasetNames: string[],
751751
url: string
752-
): Promise<Record<string, string>> {
752+
): Promise<Record<string, string> | null> {
753753
const capability = await this.getWFSCapability(url);
754+
if (!capability) return null;
754755
let featureTypeElements = capability['wfs:FeatureTypeList']['wfs:FeatureType'];
755756
featureTypeElements = this.transformData(featureTypeElements);
756757
const result = {};
@@ -779,6 +780,7 @@ export default class HighlightLayer extends mapboxgl.Evented {
779780
const lnglat1 = e.target.unproject(point1).toArray();
780781
const lnglat2 = e.target.unproject(point2).toArray();
781782
const prjInfo = await this.getDatasetProjection([datasetName], url);
783+
if (prjInfo === null) continue;
782784
const proj = prjInfo[datasetName];
783785
const transLngLat1 = transformCoordinate('EPSG:4326', proj, lnglat1);
784786
const transLngLat2 = transformCoordinate('EPSG:4326', proj, lnglat2);

static/libs/iclient-mapboxgl/iclient-mapboxgl.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)