Comparing version
{ | ||
"name": "proj4", | ||
"version": "2.4.4", | ||
"version": "2.5.0", | ||
"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.4", | ||
"version": "2.5.0", | ||
"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", |
@@ -29,3 +29,4 @@ var json = require('rollup-plugin-json'); | ||
'ortho', | ||
'qsc' | ||
'qsc', | ||
'robin' | ||
]; | ||
@@ -78,3 +79,3 @@ module.exports = function(grunt) { | ||
mangle:{ | ||
except: ['proj4','Projection','Point'] | ||
reserved: ['proj4','Projection','Point'] | ||
}, | ||
@@ -81,0 +82,0 @@ }, |
@@ -51,6 +51,9 @@ 'use strict'; | ||
Latitude = HALF_PI; | ||
} else if ((Latitude < -HALF_PI) || (Latitude > HALF_PI)) { | ||
} else if (Latitude < -HALF_PI) { | ||
/* Latitude out of range */ | ||
//..reportError('geocent:lat out of range:' + Latitude); | ||
return null; | ||
return { x: -Infinity, y: -Infinity, z: p.z }; | ||
} else if (Latitude > HALF_PI) { | ||
/* Latitude out of range */ | ||
return { x: Infinity, y: Infinity, z: p.z }; | ||
} | ||
@@ -57,0 +60,0 @@ |
@@ -25,2 +25,3 @@ import tmerc from "./projections/tmerc"; | ||
import qsc from './projections/qsc'; | ||
import robin from './projections/robin'; | ||
@@ -51,3 +52,4 @@ var projs = [ | ||
etmerc, | ||
qsc | ||
qsc, | ||
robin | ||
]; | ||
@@ -54,0 +56,0 @@ |
import defs from './defs'; | ||
import wkt from 'wkt-parser'; | ||
import projStr from './projString'; | ||
import match from './match'; | ||
function testObj(code){ | ||
@@ -10,3 +11,3 @@ return typeof code === 'string'; | ||
} | ||
var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS']; | ||
var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS']; | ||
function testWKT(code){ | ||
@@ -17,2 +18,18 @@ return codeWords.some(function (word) { | ||
} | ||
var codes = ['3857', '900913', '3785', '102113']; | ||
function checkMercator(item) { | ||
var auth = match(item, 'authority'); | ||
if (!auth) { | ||
return; | ||
} | ||
var code = match(auth, 'epsg'); | ||
return code && codes.indexOf(code) > -1; | ||
} | ||
function checkProjStr(item) { | ||
var ext = match(item, 'extension'); | ||
if (!ext) { | ||
return; | ||
} | ||
return match(ext, 'proj4'); | ||
} | ||
function testProj(code){ | ||
@@ -28,3 +45,12 @@ return code[0] === '+'; | ||
if (testWKT(code)) { | ||
return wkt(code); | ||
var out = wkt(code); | ||
// test of spetial case, due to this being a very common and often malformed | ||
if (checkMercator(out)) { | ||
return defs['EPSG:3857']; | ||
} | ||
var maybeProjStr = checkProjStr(out); | ||
if (maybeProjStr) { | ||
return projStr(maybeProjStr); | ||
} | ||
return out; | ||
} | ||
@@ -31,0 +57,0 @@ if (testProj(code)) { |
@@ -106,3 +106,3 @@ import {EPSLN, HALF_PI} from '../constants/values'; | ||
if (this.sphere) { | ||
var c = 2 * Math.atan(rh / (0.5 * this.a * this.k0)); | ||
var c = 2 * Math.atan(rh / (2 * this.a * this.k0)); | ||
lon = this.long0; | ||
@@ -109,0 +109,0 @@ lat = this.lat0; |
@@ -58,3 +58,3 @@ import gauss from './gauss'; | ||
export var names = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative"]; | ||
export var names = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative","Double_Stereographic"]; | ||
export default { | ||
@@ -61,0 +61,0 @@ init: init, |
@@ -1,2 +0,2 @@ | ||
##Proj4js -- Javascript reprojection library. | ||
## Proj4js -- Javascript reprojection library. | ||
@@ -29,2 +29,2 @@ Authors: | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
DEALINGS IN THE SOFTWARE._ | ||
DEALINGS IN THE SOFTWARE._ |
{ | ||
"name": "proj4", | ||
"version": "2.4.4", | ||
"version": "2.5.0", | ||
"description": "Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.", | ||
@@ -23,17 +23,17 @@ "main": "dist/proj4-src.js", | ||
"devDependencies": { | ||
"chai": "~1.8.1", | ||
"curl": "git://github.com/cujojs/curl.git", | ||
"chai": "~4.1.2", | ||
"curl-amd": "github:cujojs/curl", | ||
"grunt": "^1.0.1", | ||
"grunt-cli": "~0.1.13", | ||
"grunt-contrib-connect": "~0.6.0", | ||
"grunt-cli": "~1.2.0", | ||
"grunt-contrib-connect": "~1.0.2", | ||
"grunt-contrib-jshint": "~1.1.0", | ||
"grunt-contrib-uglify": "~0.11.1", | ||
"grunt-mocha-phantomjs": "~0.4.0", | ||
"grunt-rollup": "^1.0.1", | ||
"istanbul": "~0.2.4", | ||
"mocha": "~1.17.1", | ||
"rollup": "^0.41.4", | ||
"rollup-plugin-json": "^2.0.1", | ||
"rollup-plugin-node-resolve": "^2.0.0", | ||
"tin": "~0.4.0" | ||
"grunt-contrib-uglify": "~3.1.0", | ||
"grunt-mocha-phantomjs": "~4.0.0", | ||
"grunt-rollup": "^6.0.0", | ||
"istanbul": "~0.4.5", | ||
"mocha": "~4.0.0", | ||
"rollup": "^0.50.0", | ||
"rollup-plugin-json": "^2.3.0", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"tin": "~0.5.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "dependencies": { |
@@ -26,2 +26,3 @@ import tmerc from './lib/projections/tmerc'; | ||
import qsc from './lib/projections/qsc'; | ||
import robin from './lib/projections/robin'; | ||
export default function(proj4){ | ||
@@ -53,2 +54,3 @@ proj4.Proj.projections.add(tmerc); | ||
proj4.Proj.projections.add(qsc); | ||
proj4.Proj.projections.add(robin); | ||
} |
@@ -230,2 +230,6 @@ var testPoints = [ | ||
},{ | ||
code:'+proj=stere +lat_0=-90 +lon_0=0 +x_0=0 +y_0=0 +a=3396000 +b=3396000 +units=m +no_defs', | ||
ll:[0, -72.5], | ||
xy:[0, 1045388.79] | ||
},{ | ||
code:'PROJCS["WGS 84 / NSIDC Sea Ice Polar Stereographic South", GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4326"]], PROJECTION["Polar Stereographic (variant B)", AUTHORITY["EPSG","9829"]], PARAMETER["central_meridian", 0.0], PARAMETER["Standard_Parallel_1", -70.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["Easting", "North along 90 deg East"], AXIS["Northing", "North along 0 deg"], AUTHORITY["EPSG","3976"]]', | ||
@@ -400,2 +404,45 @@ ll:[0, -72.5], | ||
}, | ||
// Robinson | ||
{ | ||
code: '+proj=robin +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs', | ||
ll: [-15, -35], | ||
xy: [-1335949.91, -3743319.07], | ||
acc: {ll: 4, xy: 0} | ||
}, | ||
{ | ||
code: '+proj=robin +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs', | ||
ll: [-10, 50], | ||
xy: [-819964.60, 5326895.52], | ||
acc: {ll: 4, xy: 0} | ||
}, | ||
{ | ||
code: '+proj=robin +a=6400000', | ||
ll: [80, -20], | ||
xy: [7449059.80, -2146370.56], | ||
acc: {ll: 4, xy: 0} | ||
}, | ||
{ | ||
code: '+proj=robin +lon_0=15 +x_0=100000 +y_0=100000 +datum=WGS84', | ||
ll: [-35, 40], | ||
xy: [-4253493.26, 4376351.58], | ||
acc: {ll: 4, xy: 0} | ||
}, | ||
{ | ||
code: 'PROJCS["World_Robinson",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Robinson"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],UNIT["Meter",1]]', | ||
ll: [20, 40], | ||
xy: [1741397.30, 4276351.58], | ||
acc: {ll: 4, xy: 0} | ||
}, | ||
{ | ||
code: 'PROJCS["World_Robinson",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Robinson"],PARAMETER["False_Easting",100000],PARAMETER["False_Northing",100000],PARAMETER["Central_Meridian",15],UNIT["Meter",1]]', | ||
ll: [-35, 40], | ||
xy: [-4253493.26, 4376351.58], | ||
acc: {ll: 4, xy: 0} | ||
}, | ||
{ | ||
code: '+proj=robin +lon_0=162 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs', | ||
ll: [-90, 22], | ||
xy: [9987057.08, 2352946.55], | ||
acc: {ll: 4, xy: 0} | ||
}, | ||
// check that coordinates at 180 and -180 deg. longitude don't wrap around | ||
@@ -512,10 +559,10 @@ { | ||
{ | ||
code: '+proj=moll +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs', | ||
ll: [-180, 80.11], | ||
xy: [-5837753.259051185, 8534718.648155002] | ||
code: 'PROJCS["WGS 84 / Pseudo-Mercator", GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 0, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic latitude", NORTH], AXIS["Geodetic longitude", EAST], AUTHORITY["EPSG","4326"]], PROJECTION["Popular Visualisation Pseudo Mercator", AUTHORITY["EPSG","1024"]], PARAMETER["semi_minor", 6378137.0], PARAMETER["latitude_of_origin", 0.0], PARAMETER["central_meridian", 0.0], PARAMETER["scale_factor", 1.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH], AUTHORITY["EPSG","3857"]]', | ||
xy: [-12523490.49256873, 5166512.50707369], | ||
ll: [-112.50042920000004,42.036926809999976] | ||
}, | ||
{ | ||
code: '+proj=moll +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m', | ||
ll: [-180, 80], | ||
xy: [-5879879.246669655, 8527486.041776998] | ||
code: 'PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","9999"]]', | ||
xy: [-12523490.49256873, 5166512.50707369], | ||
ll: [-112.50042920000004,42.036926809999976] | ||
} | ||
@@ -522,0 +569,0 @@ ]; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
622775
30.26%122
2.52%12279
1.4%