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

@@ -1,4 +1,5 @@
import Projection from '../../../src/ol/proj/Projection.js';
import Units from '../../../src/ol/proj/Units.js';
import {HALF_SIZE} from '../../../src/ol/proj/epsg3857.js';
import {
METERS_PER_UNIT,
@@ -448,6 +449,20 @@ describe('ol.proj', function () {
delete proj4.defs['EPSG:3739'];
});
it('creates ol.proj.Projection instance from EPSG:4258', function () {
proj4.defs(
'EPSG:4258',
'+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs'
);
register(proj4);
const proj = getProjection('EPSG:4258');
expect(proj.getCode()).to.eql('EPSG:4258');
expect(proj.getUnits()).to.eql('degrees');
expect(proj.getMetersPerUnit()).to.eql(METERS_PER_UNIT[Units.DEGREES]);
delete proj4.defs['EPSG:4258'];
});
it('allows Proj4js projections to be used transparently', function () {
register(proj4);
const point = transform(