Comparing version
{ | ||
"name": "proj4", | ||
"version": "2.4.1", | ||
"version": "2.4.3", | ||
"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", |
{ | ||
"name": "proj4", | ||
"version": "2.4.1", | ||
"version": "2.4.3", | ||
"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", |
@@ -5,15 +5,11 @@ import adjust_lon from './adjust_lon'; | ||
if (zone === undefined) { | ||
zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI); | ||
zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1; | ||
if (zone < 0) { | ||
return 0; | ||
} else if (zone >= 60) { | ||
return 59; | ||
} else if (zone > 60) { | ||
return 60; | ||
} | ||
return zone; | ||
} else { | ||
if (zone > 0 && zone <= 60) { | ||
return zone - 1; | ||
} | ||
} | ||
return zone; | ||
} |
@@ -249,3 +249,3 @@ var exports = {}; | ||
exports.WGS84 = { | ||
export var WGS84 = exports.WGS84 = { | ||
a: 6378137.0, | ||
@@ -252,0 +252,0 @@ rf: 298.257223563, |
import {SIXTH, RA4, RA6, EPSLN} from './constants/values'; | ||
import Ellipsoid from './constants/Ellipsoid'; | ||
import {default as Ellipsoid, WGS84} from './constants/Ellipsoid'; | ||
import match from './match'; | ||
@@ -24,3 +24,2 @@ | ||
} | ||
var wgs84 = match(Ellipsoid, 'WGS84'); | ||
export function sphere(a, b, rf, ellps, sphere) { | ||
@@ -30,3 +29,3 @@ if (!a) { // do we have an ellipsoid? | ||
if (!ellipse) { | ||
ellipse = wgs84; | ||
ellipse = WGS84; | ||
} | ||
@@ -33,0 +32,0 @@ a = ellipse.a; |
@@ -38,3 +38,3 @@ import parseCode from './parseCode'; | ||
json.axis = json.axis || 'enu'; | ||
json.ellps = json.ellps || 'wgs84'; | ||
var sphere_ = dc_sphere(json.a, json.b, json.rf, json.ellps, json.sphere); | ||
@@ -41,0 +41,0 @@ var ecc = dc_eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A); |
@@ -88,3 +88,2 @@ // Heavily based on this etmerc projection implementation | ||
Cn = gatg(this.cbg, Cn); | ||
var sin_Cn = Math.sin(Cn); | ||
@@ -91,0 +90,0 @@ var cos_Cn = Math.cos(Cn); |
import adjust_zone from '../common/adjust_zone'; | ||
import etmerc from './etmerc'; | ||
export var dependsOn = 'etmerc'; | ||
import {D2R} from '../constants/values'; | ||
@@ -11,5 +12,4 @@ | ||
} | ||
this.lat0 = 0; | ||
this.long0 = (zone + 0.5) * Math.PI / 30 - Math.PI; | ||
this.long0 = ((6 * Math.abs(zone)) - 183) * D2R; | ||
this.x0 = 500000; | ||
@@ -16,0 +16,0 @@ this.y0 = this.utmSouth ? 10000000 : 0; |
{ | ||
"name": "proj4", | ||
"version": "2.4.1", | ||
"version": "2.4.3", | ||
"description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.", | ||
@@ -41,4 +41,4 @@ "main": "dist/proj4-src.js", | ||
"mgrs": "1.0.0", | ||
"wkt-parser": "^1.1.2" | ||
"wkt-parser": "^1.1.3" | ||
} | ||
} |
@@ -183,3 +183,18 @@ // You can do this in the grunt config for each mocha task, see the `options` config | ||
assert.equal(proj4.defs['EPSG:4279'].to_meter, 6377563.396*0.01745329251994328); | ||
}); | ||
}); | ||
it('should parse wkt and proj4 of the same crs and result in the same params', function() { | ||
var s1 = 'GEOGCS["PSD93",DATUM["PDO_Survey_Datum_1993",SPHEROID["Clarke 1880 (RGS)",6378249.145,293.465,AUTHORITY["EPSG","7012"]],TOWGS84[-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.7101],AUTHORITY["EPSG","6134"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4134"]]'; | ||
var s2 = '+proj=longlat +ellps=clrk80 +towgs84=-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.7101 +no_defs'; | ||
var crs1 = proj4(s1); | ||
var crs2 = proj4(s2); | ||
assert.equal(crs1.oProj.a, crs2.oProj.a); | ||
// proj4 has different ellipsoid parameters that EPSG: http://epsg.io/4134 | ||
// assert.equal(crs1.oProj.b, crs2.oProj.b); | ||
}); | ||
it('should handled defined points correctly', function () { | ||
var prj = '+proj=utm +zone=31'; | ||
var proj = proj4(prj); | ||
var res = proj.forward([3, 0]); | ||
assert.deepEqual(res, [500000, 0]); | ||
}); | ||
}); | ||
@@ -186,0 +201,0 @@ }); |
@@ -32,3 +32,3 @@ var testPoints = [ | ||
}, | ||
{code:'PROJCS["NAD83 / Massachusetts Mainland", GEOGCS["NAD83", DATUM["North American Datum 1983", SPHEROID["GRS 1980", 6378137.0, 298.257222101, AUTHORITY["EPSG","7019"]], TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], AUTHORITY["EPSG","6269"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4269"]], PROJECTION["Lambert_Conformal_Conic_2SP", AUTHORITY["EPSG","9802"]], PARAMETER["central_meridian", -71.5], PARAMETER["latitude_of_origin", 41.0], PARAMETER["standard_parallel_1", 42.68333333333334], PARAMETER["false_easting", 200000.0], PARAMETER["false_northing", 750000.0], PARAMETER["scale_factor", 1.0], PARAMETER["standard_parallel_2", 41.71666666666667], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH], AUTHORITY["EPSG","26986"]]', | ||
{code:'PROJCS["NAD83 / Massachusetts Mainland", GEOGCS["NAD83", DATUM["North American Datum 1983", SPHEROID["GRS 1980", 6378137.0, 298.257222101, AUTHORITY["EPSG","7019"]], TOWGS84[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], AUTHORITY["EPSG","6269"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4269"]], PROJECTION["Lambert_Conformal_Conic_2SP", AUTHORITY["EPSG","9802"]], PARAMETER["central_meridian", -71.5], PARAMETER["latitude_of_origin", 41.0], PARAMETER["standard_parallel_1", 42.68333333333334], PARAMETER["false_easting", 200000.0], PARAMETER["false_northing", 750000.0], PARAMETER["scale_factor", 1.0], PARAMETER["standard_parallel_2", 41.71666666666667], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH], AUTHORITY["EPSG","26986"]]', | ||
xy: [ 231394.84,902621.11], | ||
@@ -397,2 +397,17 @@ ll: [-71.11881762742996,42.37346263960867] | ||
xy: [532247.285, 2208091.8723] | ||
}, | ||
{ | ||
code: '+proj=utm +zone=33 +units=m +no_defs', | ||
ll: [2, 1], | ||
xy: [-959006.4926646841, 113457.31956265299] | ||
}, | ||
{ | ||
code: '+proj=utm +zone=33 +units=m', | ||
ll: [2, 1], | ||
xy: [-959006.4926646841, 113457.31956265299] | ||
}, | ||
{ | ||
code: '+proj=utm +zone=33', | ||
ll: [2, 1], | ||
xy: [-959006.4926646841, 113457.31956265299] | ||
} | ||
@@ -399,0 +414,0 @@ ]; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
442365
0.33%11195
0.27%Updated