Merge pull request #3303 from ahocevar/us-ft
Add constant for us-ft units
This commit is contained in:
@@ -32,7 +32,8 @@ ol.proj.Units = {
|
||||
DEGREES: 'degrees',
|
||||
FEET: 'ft',
|
||||
METERS: 'm',
|
||||
PIXELS: 'pixels'
|
||||
PIXELS: 'pixels',
|
||||
USFEET: 'us-ft'
|
||||
};
|
||||
|
||||
|
||||
@@ -47,6 +48,7 @@ ol.proj.METERS_PER_UNIT[ol.proj.Units.DEGREES] =
|
||||
2 * Math.PI * ol.sphere.NORMAL.radius / 360;
|
||||
ol.proj.METERS_PER_UNIT[ol.proj.Units.FEET] = 0.3048;
|
||||
ol.proj.METERS_PER_UNIT[ol.proj.Units.METERS] = 1;
|
||||
ol.proj.METERS_PER_UNIT[ol.proj.Units.USFEET] = 1200 / 3937;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -366,10 +366,15 @@ describe('ol.proj', function() {
|
||||
'+proj=lcc +lat_1=29.3 +lat_2=30.7 +lat_0=28.66666666666667 ' +
|
||||
'+lon_0=-91.33333333333333 +x_0=609601.2192024384 +y_0=0 ' +
|
||||
'+ellps=clrk66 +datum=NAD27 +to_meter=0.3048006096012192 +no_defs');
|
||||
proj4.defs('EPSG:3739', '+proj=tmerc +lat_0=40.5 ' +
|
||||
'+lon_0=-110.0833333333333 +k=0.9999375 +x_0=800000.0000101599 ' +
|
||||
'+y_0=99999.99998983997 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 ' +
|
||||
'+units=us-ft +no_defs');
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
delete proj4.defs['EPSG:26782'];
|
||||
delete proj4.defs['EPSG:3739'];
|
||||
});
|
||||
|
||||
it('returns value in meters', function() {
|
||||
@@ -382,6 +387,11 @@ describe('ol.proj', function() {
|
||||
expect(epsg26782.getMetersPerUnit()).to.eql(0.3048006096012192);
|
||||
});
|
||||
|
||||
it('works for proj4js projections with units other than m', function() {
|
||||
var epsg3739 = ol.proj.get('EPSG:3739');
|
||||
expect(epsg3739.getMetersPerUnit()).to.eql(1200 / 3937);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user