diff --git a/common/changes/@itwin/core-frontend/geo-validateEsriMapService_2022-03-08-20-15.json b/common/changes/@itwin/core-frontend/geo-validateEsriMapService_2022-03-08-20-15.json new file mode 100644 index 000000000000..a621c51fac97 --- /dev/null +++ b/common/changes/@itwin/core-frontend/geo-validateEsriMapService_2022-03-08-20-15.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@itwin/core-frontend", + "comment": "Improved validation of ESRI services before adding map layer", + "type": "none" + } + ], + "packageName": "@itwin/core-frontend" +} \ No newline at end of file diff --git a/core/frontend/src/tile/map/ArcGisUtilities.ts b/core/frontend/src/tile/map/ArcGisUtilities.ts index 2c2aab03a52b..26aa2698e93d 100644 --- a/core/frontend/src/tile/map/ArcGisUtilities.ts +++ b/core/frontend/src/tile/map/ArcGisUtilities.ts @@ -140,6 +140,19 @@ export class ArcGisUtilities { return { status: MapLayerSourceStatus.InvalidCredentials, authInfo: { authMethod: MapLayerAuthType.EsriToken } }; } + // Check this service support map queries + let hasMapCapability = false; + try { + if (json.capabilities + && typeof json.capabilities === "string" + && json.capabilities.toLowerCase().includes("map")) { + hasMapCapability = true; + } + } catch { } + if (!hasMapCapability) { + return { status: MapLayerSourceStatus.InvalidFormat}; + } + let subLayers; if (json.layers) {