Support OGC WKT proj4 def.units and def.to_meter

This commit is contained in:
Torben Barsbsballe
2015-10-06 15:57:01 -07:00
parent da830a7670
commit 7cefe56167
3 changed files with 30 additions and 3 deletions

View File

@@ -495,11 +495,28 @@ describe('ol.proj', function() {
'+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');
proj4.defs('EPSG:4269', 'GEOGCS["NAD83",' +
'DATUM["North_American_Datum_1983",' +
'SPHEROID["GRS 1980",6378137,298.257222101,' +
'AUTHORITY["EPSG","7019"]],' +
'AUTHORITY["EPSG","6269"]],' +
'PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],' +
'UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],' +
'AUTHORITY["EPSG","4269"]]');
proj4.defs('EPSG:4279', 'GEOGCS["OS(SN)80",DATUM["OS_SN_1980",' +
'SPHEROID["Airy 1830",6377563.396,299.3249646,' +
'AUTHORITY["EPSG","7001"]],' +
'AUTHORITY["EPSG","6279"]],' +
'PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],' +
'UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],' +
'AUTHORITY["EPSG","4279"]]');
});
afterEach(function() {
delete proj4.defs['EPSG:26782'];
delete proj4.defs['EPSG:3739'];
delete proj4.defs['EPSG:4269'];
delete proj4.defs['EPSG:4279'];
});
it('returns value in meters', function() {
@@ -517,6 +534,15 @@ describe('ol.proj', function() {
expect(epsg3739.getMetersPerUnit()).to.eql(1200 / 3937);
});
it('works for proj4js OGC WKT GEOGCS projections', function() {
var epsg4269 = ol.proj.get('EPSG:4269');
expect(epsg4269.getMetersPerUnit()).to.eql(
6378137 * 0.01745329251994328);
var epsg4279 = ol.proj.get('EPSG:4279');
expect(epsg4279.getMetersPerUnit()).to.eql(
6377563.396 * 0.01745329251994328);
});
});
});