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

@@ -124,10 +124,7 @@ export function createFromCapabilitiesMatrixSet(
const tileHeightPropName = 'TileHeight';
const code = matrixSet[supportedCRSPropName];
const projection =
getProjection(
code.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')
) || getProjection(code);
const projection = getProjection(code);
const metersPerUnit = projection.getMetersPerUnit();
// swap origin x and y coordinates if axis orientation is lat/long
const switchOriginXY = projection.getAxisOrientation().substr(0, 2) == 'ne';