Comparing version 2.2.0 to 2.2.1
{ | ||
"name": "proj4", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/proj4js/proj4js", |
Change log | ||
=== | ||
- 2.2.0: Documentation fixes and added proj4.defs('name') as an alias for proj4.defs['name']; | ||
- 2.2.1: Documentation fixes and added proj4.defs('name') as an alias for proj4.defs['name']; | ||
@@ -5,0 +5,0 @@ - 2.1.4: dist folder is added back in after accidentally omitting it in 2.1.1 |
{ | ||
"name": "proj4", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.", | ||
@@ -5,0 +5,0 @@ "repo": "proj4js/proj4js", |
@@ -9,8 +9,13 @@ var globals = require('./global'); | ||
if (arguments.length === 2) { | ||
if (arguments[1][0] === '+') { | ||
defs[name] = parseProj(arguments[1]); | ||
var def = arguments[1]; | ||
if (typeof def === 'string') { | ||
if (def[0] === '+') { | ||
defs[name] = parseProj(arguments[1]); | ||
} | ||
else { | ||
defs[name] = wkt(arguments[1]); | ||
} | ||
} else { | ||
defs[name] = def; | ||
} | ||
else { | ||
defs[name] = wkt(arguments[1]); | ||
} | ||
} | ||
@@ -29,3 +34,5 @@ else if (arguments.length === 1) { | ||
else if (typeof name === 'string') { | ||
if (name in defs) { | ||
return defs[name]; | ||
} | ||
} | ||
@@ -32,0 +39,0 @@ else if ('EPSG' in name) { |
module.exports = function(defs) { | ||
defs('WGS84', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"); | ||
defs('EPSG:4326', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"); | ||
@@ -7,2 +6,3 @@ defs('EPSG:4269', "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"); | ||
defs.WGS84 = defs['EPSG:4326']; | ||
defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857 | ||
@@ -9,0 +9,0 @@ defs.GOOGLE = defs['EPSG:3857']; |
{ | ||
"name": "proj4", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -70,3 +70,3 @@ #PROJ4JS | ||
If you prefer to define a projection as a string and refence it that way, you may use the proj4.defs method which can be called 2 ways, with a name and projection: | ||
If you prefer to define a projection as a string and reference it that way, you may use the proj4.defs method which can be called 2 ways, with a name and projection: | ||
@@ -99,4 +99,4 @@ ```js | ||
- 'WGS84' | ||
- 'EPSG:4326' | ||
- 'EPSG:4326', which has the following alias | ||
- 'WGS84' | ||
- 'EPSG:4269' | ||
@@ -109,4 +109,10 @@ - 'EPSG:3857', which has the following aliases | ||
defined projections can also be accessed as properties of the proj4.defs function (`proj4.defs['EPSG:4326']`). | ||
defined projections can also be accessed through the proj4.defs function (`proj4.defs('EPSG:4326')`). | ||
proj4.defs can also be used to define a named alias: | ||
```javascript | ||
proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326')); | ||
``` | ||
##Developing | ||
@@ -113,0 +119,0 @@ to set up build tools make sure you have node and grunt-cli installed and then run `npm install` |
@@ -162,2 +162,9 @@ // You can do this in the grunt config for each mocha task, see the `options` config | ||
}); | ||
describe('defs', function() { | ||
assert.equal(proj4.defs('testmerc'), proj4.defs['testmerc']); | ||
proj4.defs('foo', '+proj=merc +lon_0=5.937 +lat_ts=45.027 +ellps=sphere +datum=none'); | ||
assert.typeOf(proj4.defs['foo'], 'object'); | ||
proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326')); | ||
assert.strictEqual(proj4.defs['urn:x-ogc:def:crs:EPSG:4326'], proj4.defs['EPSG:4326']); | ||
}); | ||
describe('errors', function() { | ||
@@ -169,3 +176,3 @@ it('should throw an error for an unknown ref', function() { | ||
}); | ||
}) | ||
}); | ||
describe('utility', function() { | ||
@@ -210,3 +217,3 @@ it('should have MGRS available in the proj4.util namespace', function() { | ||
}); | ||
}) | ||
}); | ||
}); | ||
@@ -213,0 +220,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
428091
10524
152