Use regexp replacements in ol.proj.get

This avoids to have to many redundant identifier definitions for each projection and ensure to cover most of the existing srsNames
This commit is contained in:
Florent gravin
2020-09-07 17:06:44 +02:00
parent 8eb5ac900d
commit 5d8aa85caa
5 changed files with 8 additions and 19 deletions

View File

@@ -369,10 +369,7 @@ export function optionsFromCapabilities(wmtsCap, config) {
return el['Identifier'] == elt['TileMatrixSet'];
});
const supportedCRS = tileMatrixSet['SupportedCRS'];
const proj1 =
getProjection(
supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')
) || getProjection(supportedCRS);
const proj1 = getProjection(supportedCRS);
const proj2 = getProjection(config['projection']);
if (proj1 && proj2) {
return equivalent(proj1, proj2);
@@ -434,10 +431,7 @@ export function optionsFromCapabilities(wmtsCap, config) {
let projection;
const code = matrixSetObj['SupportedCRS'];
if (code) {
projection =
getProjection(
code.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')
) || getProjection(code);
projection = getProjection(code);
}
if ('projection' in config) {
const projConfig = getProjection(config['projection']);