Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
xilanhuaweidapao committed Mar 2, 2023
1 parent b3c1d63 commit a0565a4
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/common/_utils/WebMapService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ const MB_SCALEDENOMINATOR_4326 = [
'17061.836670798268',
'8530.918335399134'
];

// 用于决定哪些字段必须返回数组格式
const WMTS_ALWAYS_ARRAY_FIELDS = ['Layer', 'TileMatrixSet', 'ows:Operation', 'ows:Get', 'ResourceURL', 'Style'];
interface webMapOptions {
serverUrl?: string;
accessToken?: string;
Expand Down Expand Up @@ -276,14 +277,13 @@ export default class WebMapService extends Events {
})
.then(capabilitiesText => {
let converts = convert || window.convert;
const capabilities = JSON.parse(
converts.xml2json(capabilitiesText, {
compact: true,
spaces: 4,
// 用于决定哪些字段必须返回数组格式
alwaysArray: ['Layer', 'TileMatrixSet', 'ows:Operation', 'ows:Get', 'ResourceURL', 'Style']
})
).Capabilities;
const convertConfig = {
alwaysArray: WMTS_ALWAYS_ARRAY_FIELDS,
compact: true,
spaces: 4
};
const result = converts.xml2json(capabilitiesText, convertConfig);
const capabilities = JSON.parse(result).Capabilities;
const content = capabilities.Contents;
const metaData = capabilities['ows:OperationsMetadata'];
if (metaData) {
Expand Down

0 comments on commit a0565a4

Please sign in to comment.