Comparing version
{ | ||
"name": "proj4", | ||
"version": "2.6.1", | ||
"version": "2.6.2", | ||
"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.6.1", | ||
"version": "2.6.2", | ||
"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", |
@@ -44,3 +44,3 @@ import adjust_lon from '../common/adjust_lon'; | ||
c = Math.acos(cos_c); | ||
kp = c / Math.sin(c); | ||
kp = c ? c / Math.sin(c) : 1; | ||
p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon); | ||
@@ -109,3 +109,3 @@ p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon)); | ||
p.y -= this.y0; | ||
var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F; | ||
var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F, sinpsi; | ||
if (this.sphere) { | ||
@@ -194,3 +194,4 @@ rh = Math.sqrt(p.x * p.x + p.y * p.y); | ||
lon = adjust_lon(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi))); | ||
lat = Math.atan((1 - this.es * F * this.sin_p12 / Math.sin(psi)) * Math.tan(psi) / (1 - this.es)); | ||
sinpsi = Math.sin(psi); | ||
lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es)); | ||
p.x = lon; | ||
@@ -197,0 +198,0 @@ p.y = lat; |
@@ -98,3 +98,3 @@ | ||
} | ||
if (Math.abs(phi + this.phi0) < EPSLN) { | ||
if (Math.abs(phi + this.lat0) < EPSLN) { | ||
return null; | ||
@@ -198,3 +198,3 @@ } | ||
case this.OBLIQ: | ||
phi = (Math.abs(rh) <= EPSLN) ? this.phi0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh); | ||
phi = (Math.abs(rh) <= EPSLN) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh); | ||
x *= sinz * this.cosph0; | ||
@@ -220,4 +220,4 @@ y = (cosz - Math.sin(phi) * this.sinph0) * rh; | ||
if (rho < EPSLN) { | ||
p.x = 0; | ||
p.y = this.phi0; | ||
p.x = this.long0; | ||
p.y = this.lat0; | ||
return p; | ||
@@ -245,4 +245,4 @@ } | ||
if (!q) { | ||
p.x = 0; | ||
p.y = this.phi0; | ||
p.x = this.long0; | ||
p.y = this.lat0; | ||
return p; | ||
@@ -249,0 +249,0 @@ } |
@@ -44,2 +44,5 @@ import {D2R, R2D, PJD_3PARAM, PJD_7PARAM} from './constants/values'; | ||
point = source.inverse(point); // Convert Cartesian to longlat | ||
if (!point) { | ||
return; | ||
} | ||
} | ||
@@ -46,0 +49,0 @@ // Adjust for the prime meridian if necessary |
{ | ||
"name": "proj4", | ||
"version": "2.6.1", | ||
"version": "2.6.2", | ||
"description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.", | ||
@@ -5,0 +5,0 @@ "main": "dist/proj4-src.js", |
# PROJ4JS [](https://travis-ci.org/proj4js/proj4js) | ||
Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations. | ||
Originally a port of [PROJ.4](http://trac.osgeo.org/proj/) and [GCTCP C](http://edcftp.cr.usgs.gov/pub//software/gctpc) it is | ||
a part of the [MetaCRS](http://wiki.osgeo.org/wiki/MetaCRS) group of projects. | ||
Originally a port of [PROJ](https://proj.org/) ([then known as PROJ.4](https://proj.org/faq.html#what-happened-to-proj-4)) and GCTCP C ([Archive](https://web.archive.org/web/20130523091752/http://edcftp.cr.usgs.gov/pub/software/gctpc/)) it is | ||
a part of the [MetaCRS](https://trac.osgeo.org/metacrs/wiki) group of projects. | ||
@@ -19,7 +19,7 @@ ## Installing | ||
if you do not want to download anything, Proj4js is also hosted on [cdnjs](http://www.cdnjs.com/libraries/proj4js) for direct use in your browser applications. | ||
If you do not want to download anything, Proj4js is also hosted on [cdnjs](https://www.cdnjs.com/libraries/proj4js) for direct use in your browser applications. | ||
## Using | ||
the basic signature is: | ||
The basic signature is: | ||
@@ -60,3 +60,3 @@ ```javascript | ||
and as above if only one projection is given, it's assumed to be coming from wgs84 | ||
And as above if only one projection is given, it's assumed to be coming from wgs84: | ||
@@ -110,3 +110,3 @@ ```javascript | ||
defined projections can also be accessed through the proj4.defs function (`proj4.defs('EPSG:4326')`). | ||
Defined projections can also be accessed through the proj4.defs function (`proj4.defs('EPSG:4326')`). | ||
@@ -128,5 +128,5 @@ proj4.defs can also be used to define a named alias: | ||
## Developing | ||
to set up build tools make sure you have node and grunt-cli installed and then run `npm install` | ||
To set up build tools make sure you have node and grunt-cli installed and then run `npm install`. | ||
to do the complete build and browser tests run | ||
To do the complete build and browser tests run: | ||
@@ -137,3 +137,3 @@ ```bash | ||
to run node tests run | ||
To run node tests run: | ||
@@ -144,3 +144,3 @@ ```bash | ||
to run node tests with coverage run | ||
To run node tests with coverage run: | ||
@@ -151,3 +151,3 @@ ```bash | ||
to create a build with only default projections (latlon and Mercator) run | ||
To create a build with only default projections (latlon and Mercator) run: | ||
@@ -158,3 +158,3 @@ ```bash | ||
to create a build with only custom projections include a comma separated list of projections codes (the file name in 'lib/projections' without the '.js') after a colon, e.g. | ||
To create a build with only custom projections include a comma separated list of projections codes (the file name in 'lib/projections' without the '.js') after a colon, e.g.: | ||
@@ -161,0 +161,0 @@ ```bash |
@@ -92,2 +92,12 @@ var testPoints = [ | ||
{ | ||
code:'PROJCS["Azimuthal_Equidistant",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Azimuthal_Equidistant"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Latitude_Of_Origin",0],UNIT["Meter",1]]', | ||
ll:[0, 0], | ||
xy:[0, 0] | ||
}, | ||
{ | ||
code:'PROJCS["Sphere_Azimuthal_Equidistant",GEOGCS["GCS_Sphere",DATUM["Not_specified_based_on_Authalic_Sphere",SPHEROID["Sphere",6371000,0]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Azimuthal_Equidistant"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Latitude_Of_Origin",0],UNIT["Meter",1]]', | ||
ll:[0, 0], | ||
xy:[0, 0] | ||
}, | ||
{ | ||
code:'PROJCS["North_Pole_Azimuthal_Equidistant",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Azimuthal_Equidistant"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Latitude_Of_Origin",90],UNIT["Meter",1]]', | ||
@@ -227,2 +237,38 @@ ll:[50.977303830208, 30.915260093747], | ||
},{ | ||
code:'+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs', | ||
ll:[2, 0], | ||
xy:[222638.98158654713, 0] | ||
},{ | ||
code:'+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs', | ||
ll:[89, 0], | ||
xy:[9907434.680601358, 0] | ||
},{ | ||
// code:'+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs', | ||
// ll:[91, 0], | ||
// xy:[10130073.6622, 0] | ||
// },{ | ||
code:'+proj=aeqd +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs', | ||
ll:[91, 0], | ||
xy:[10118738.32, 0.00] | ||
},{ | ||
code:'+proj=laea +lat_0=2 +lon_0=1 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs', | ||
ll:[1, 2], | ||
xy:[0, 0] | ||
},{ | ||
code:'+proj=laea +lat_0=1 +lon_0=1 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs', | ||
ll:[1, 1], | ||
xy:[0, 0] | ||
},{ | ||
code:'+proj=laea +lat_0=1 +lon_0=1 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs', | ||
ll:[2, 1], | ||
xy:[111176.58, 16.93] | ||
},{ | ||
code:'+proj=laea +lat_0=1 +lon_0=1 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs', | ||
ll:[1, 2], | ||
xy:[0.00,111193.52] | ||
},{ | ||
code:'+proj=laea +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +a=6371000 +b=6371000 +units=m +no_defs', | ||
ll:[19, 0], | ||
xy:[2103036.59, 0.00] | ||
},{ | ||
code:'+proj=stere +lat_0=-90 +lat_ts=-70 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs"', | ||
@@ -593,2 +639,2 @@ ll:[0, -72.5], | ||
}); | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
525389
0.48%12525
0.46%