Merge pull request #11509 from fgravin/proj-4326-identifier

Add urn:x-ogc:def:crs:EPSG:6.6:4326 as WGS84 proj identifier
This commit is contained in:
Andreas Hocevar
2020-09-09 10:22:34 +02:00
committed by GitHub
6 changed files with 11 additions and 20 deletions
-2
View File
@@ -64,8 +64,6 @@ export const PROJECTIONS = [
new EPSG3857Projection('EPSG:102100'), new EPSG3857Projection('EPSG:102100'),
new EPSG3857Projection('EPSG:102113'), new EPSG3857Projection('EPSG:102113'),
new EPSG3857Projection('EPSG:900913'), new EPSG3857Projection('EPSG:900913'),
new EPSG3857Projection('urn:ogc:def:crs:EPSG:6.18:3:3857'),
new EPSG3857Projection('urn:ogc:def:crs:EPSG::3857'),
new EPSG3857Projection('http://www.opengis.net/gml/srs/epsg.xml#3857'), new EPSG3857Projection('http://www.opengis.net/gml/srs/epsg.xml#3857'),
]; ];
-3
View File
@@ -61,10 +61,7 @@ class EPSG4326Projection extends Projection {
export const PROJECTIONS = [ export const PROJECTIONS = [
new EPSG4326Projection('CRS:84'), new EPSG4326Projection('CRS:84'),
new EPSG4326Projection('EPSG:4326', 'neu'), new EPSG4326Projection('EPSG:4326', 'neu'),
new EPSG4326Projection('urn:ogc:def:crs:EPSG::4326', 'neu'),
new EPSG4326Projection('urn:ogc:def:crs:EPSG:6.6:4326', 'neu'),
new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'), new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'),
new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'), new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'),
new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'), new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'),
new EPSG4326Projection('urn:x-ogc:def:crs:EPSG:4326', 'neu'),
]; ];
+5 -1
View File
@@ -20,7 +20,11 @@ export function clear() {
* @return {import("./Projection.js").default} The projection (if cached). * @return {import("./Projection.js").default} The projection (if cached).
*/ */
export function get(code) { export function get(code) {
return cache[code] || null; return (
cache[code] ||
cache[code.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/, 'EPSG:$3')] ||
null
);
} }
/** /**
+2 -8
View File
@@ -369,10 +369,7 @@ export function optionsFromCapabilities(wmtsCap, config) {
return el['Identifier'] == elt['TileMatrixSet']; return el['Identifier'] == elt['TileMatrixSet'];
}); });
const supportedCRS = tileMatrixSet['SupportedCRS']; const supportedCRS = tileMatrixSet['SupportedCRS'];
const proj1 = const proj1 = getProjection(supportedCRS);
getProjection(
supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')
) || getProjection(supportedCRS);
const proj2 = getProjection(config['projection']); const proj2 = getProjection(config['projection']);
if (proj1 && proj2) { if (proj1 && proj2) {
return equivalent(proj1, proj2); return equivalent(proj1, proj2);
@@ -434,10 +431,7 @@ export function optionsFromCapabilities(wmtsCap, config) {
let projection; let projection;
const code = matrixSetObj['SupportedCRS']; const code = matrixSetObj['SupportedCRS'];
if (code) { if (code) {
projection = projection = getProjection(code);
getProjection(
code.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')
) || getProjection(code);
} }
if ('projection' in config) { if ('projection' in config) {
const projConfig = getProjection(config['projection']); const projConfig = getProjection(config['projection']);
+1 -4
View File
@@ -124,10 +124,7 @@ export function createFromCapabilitiesMatrixSet(
const tileHeightPropName = 'TileHeight'; const tileHeightPropName = 'TileHeight';
const code = matrixSet[supportedCRSPropName]; const code = matrixSet[supportedCRSPropName];
const projection = const projection = getProjection(code);
getProjection(
code.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')
) || getProjection(code);
const metersPerUnit = projection.getMetersPerUnit(); const metersPerUnit = projection.getMetersPerUnit();
// swap origin x and y coordinates if axis orientation is lat/long // swap origin x and y coordinates if axis orientation is lat/long
const switchOriginXY = projection.getAxisOrientation().substr(0, 2) == 'ne'; const switchOriginXY = projection.getAxisOrientation().substr(0, 2) == 'ne';
+3 -2
View File
@@ -215,12 +215,13 @@ describe('ol.proj', function () {
}); });
it( it(
'gives that CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, EPSG:4326 are ' + 'gives that CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, EPSG:4326, ' +
'equivalent', 'urn:x-ogc:def:crs:EPSG:6.6:4326 are equivalent',
function () { function () {
_testAllEquivalent([ _testAllEquivalent([
'CRS:84', 'CRS:84',
'urn:ogc:def:crs:EPSG:6.6:4326', 'urn:ogc:def:crs:EPSG:6.6:4326',
'urn:x-ogc:def:crs:EPSG:6.6:4326',
'EPSG:4326', 'EPSG:4326',
]); ]);
} }