MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / isSameRasterUrl

Function isSameRasterUrl

src/common/mapping/utils/util.js:168–183  ·  view source on GitHub ↗
(urlA, urlB)

Source from the content-addressed store, hash-verified

166}
167
168function isSameRasterUrl(urlA, urlB) {
169 if (urlA === urlB) {
170 return true;
171 }
172 const uriA = new URL(urlA);
173 const uriB = new URL(urlB);
174 if (uriA.origin !== uriB.origin) {
175 return false;
176 }
177 const regex = /\/([^/?#]+\.\w+)$/;
178 const pathA = uriA.pathname.replace(regex, '');
179 const pathB = uriB.pathname.replace(regex, '');
180
181 // 3. 判断子路径关系
182 return pathA === pathB || pathA.startsWith(pathB + (pathB.endsWith('/') ? '' : '/'));
183}
184
185export function isSameRasterLayer(sourceInfo, compareSource) {
186 const { type, tiles } = sourceInfo;

Callers 1

isSameRasterLayerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected