Add ol.proj.setProj4 function
This commit is contained in:
@@ -221,6 +221,25 @@ describe('ol.proj', function() {
|
||||
delete proj4.defs['EPSG:21781'];
|
||||
});
|
||||
|
||||
it('can use an alternative namespace for proj4', function() {
|
||||
var proj4 = window.proj4;
|
||||
var proj4new = proj4;
|
||||
delete window.proj4;
|
||||
ol.proj.setProj4(proj4new);
|
||||
proj4new.defs('EPSG:21781',
|
||||
'+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 ' +
|
||||
'+k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel ' +
|
||||
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs');
|
||||
var proj = ol.proj.get('EPSG:21781');
|
||||
expect(proj.getCode()).to.eql('EPSG:21781');
|
||||
expect(proj.getUnits()).to.eql('m');
|
||||
expect(proj.getMetersPerUnit()).to.eql(1);
|
||||
|
||||
delete proj4new.defs['EPSG:21781'];
|
||||
window.proj4 = proj4;
|
||||
ol.proj.setProj4(window.proj4);
|
||||
});
|
||||
|
||||
it('creates ol.proj.Projection instance from EPSG:3739', function() {
|
||||
proj4.defs('EPSG:3739',
|
||||
'+proj=tmerc +lat_0=40.5 +lon_0=-110.0833333333333 +k=0.9999375 ' +
|
||||
|
||||
Reference in New Issue
Block a user