Deal with undefined units from proj4 longlat projections

This commit is contained in:
Andreas Hocevar
2020-10-14 23:24:13 +02:00
parent d4acf2ce10
commit 527a8ca810
2 changed files with 21 additions and 1 deletions

View File

@@ -2,6 +2,7 @@
* @module ol/proj/proj4
*/
import Projection from './Projection.js';
import Units from './Units.js';
import {
addCoordinateTransforms,
addEquivalentProjections,
@@ -31,12 +32,16 @@ export function register(proj4) {
const code = projCodes[i];
if (!get(code)) {
const def = proj4.defs(code);
let units = def.units;
if (!units && def.projName === 'longlat') {
units = Units.DEGREES;
}
addProjection(
new Projection({
code: code,
axisOrientation: def.axis,
metersPerUnit: def.to_meter,
units: def.units,
units,
})
);
}