Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Added scale line, upgrade proj4js

Mike McGanncb5404e68eaf
diff --git a/buster.js b/buster.js
index 92b9da359..7fb5e2016 100644
--- a/buster.js
+++ b/buster.js
@@ -19,6 +19,7 @@ config["wv"] = {
"web/ext/main/jquery-1.11.0/jquery.js",
"web/ext/main/jquery.migrate-1.2.1/jquery-migrate.min.js",
"web/ext/main/jscache-gitba01cdc/cache.js",
+ "web/ext/proj/proj4js-2.3.3-1/proj4.js",
"web/ext/map/openlayers-3.1.0/ol.js",
"test/fixtures.js"
],
diff --git a/lib/proj4js-1.1.0-1/Gruntfile.js b/lib/proj4js-1.1.0-1/Gruntfile.js
deleted file mode 100644
index 771e0ff12..000000000
--- a/lib/proj4js-1.1.0-1/Gruntfile.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * NASA Worldview
- *
- * This code was originally developed at NASA/Goddard Space Flight Center for
- * the Earth Science Data and Information System (ESDIS) project.
- *
- * Copyright (C) 2013 - 2014 United States Government as represented by the
- * Administrator of the National Aeronautics and Space Administration.
- * All Rights Reserved.
- */
-
-module.exports = function(grunt) {
-
- var name = "proj4js";
- var version = "1.1.0-1";
- var base = "wv.proj";
-
- var lib = "lib/" + name + "-" + version + "/";
- var ext = "src/ext/" + base + "/" + name + "-" + version + "/";
- var debug_js = ext + name + ".js";
- var min_js = ext + name + ".min.js";
-
- var js = [
- lib + "proj4js.js",
- lib + "merc.js",
- lib + "stere.js"
- ];
-
- var uglifyFiles = {};
- uglifyFiles[min_js] = [debug_js];
-
- grunt.initConfig({
- concat: {
- js: {
- src: js,
- dest: debug_js
- },
- },
-
- uglify: {
- js: {
- files: uglifyFiles
- }
- }
- });
-
- grunt.file.setBase("../..");
- grunt.loadNpmTasks("grunt-contrib-concat");
- grunt.loadNpmTasks("grunt-contrib-uglify");
-
- grunt.registerTask("default", ["concat", "uglify"]);
-
-};
-
diff --git a/lib/proj4js-1.1.0-1/merc.js b/lib/proj4js-1.1.0-1/merc.js
deleted file mode 100644
index ebf55a77d..000000000
--- a/lib/proj4js-1.1.0-1/merc.js
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
-NAME MERCATOR
-
-PURPOSE: Transforms input longitude and latitude to Easting and
- Northing for the Mercator projection. The
- longitude and latitude must be in radians. The Easting
- and Northing values will be returned in meters.
-
-PROGRAMMER DATE
----------- ----
-D. Steinwand, EROS Nov, 1991
-T. Mittan Mar, 1993
-
-ALGORITHM REFERENCES
-
-1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
- Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
- State Government Printing Office, Washington D.C., 1987.
-
-2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
- U.S. Geological Survey Professional Paper 1453 , United State Government
- Printing Office, Washington D.C., 1989.
-*******************************************************************************/
-
-//static double r_major = a; /* major axis */
-//static double r_minor = b; /* minor axis */
-//static double lon_center = long0; /* Center longitude (projection center) */
-//static double lat_origin = lat0; /* center latitude */
-//static double e,es; /* eccentricity constants */
-//static double m1; /* small value m */
-//static double false_northing = y0; /* y offset in meters */
-//static double false_easting = x0; /* x offset in meters */
-//scale_fact = k0
-
-Proj4js.Proj.merc = {
- init : function() {
- //?this.temp = this.r_minor / this.r_major;
- //this.temp = this.b / this.a;
- //this.es = 1.0 - Math.sqrt(this.temp);
- //this.e = Math.sqrt( this.es );
- //?this.m1 = Math.cos(this.lat_origin) / (Math.sqrt( 1.0 - this.es * Math.sin(this.lat_origin) * Math.sin(this.lat_origin)));
- //this.m1 = Math.cos(0.0) / (Math.sqrt( 1.0 - this.es * Math.sin(0.0) * Math.sin(0.0)));
- if (this.lat_ts) {
- if (this.sphere) {
- this.k0 = Math.cos(this.lat_ts);
- } else {
- this.k0 = Proj4js.common.msfnz(this.es, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
- }
- }
- },
-
-/* Mercator forward equations--mapping lat,long to x,y
- --------------------------------------------------*/
-
- forward : function(p) {
- //alert("ll2m coords : "+coords);
- var lon = p.x;
- var lat = p.y;
- // convert to radians
- if ( lat*Proj4js.common.R2D > 90.0 &&
- lat*Proj4js.common.R2D < -90.0 &&
- lon*Proj4js.common.R2D > 180.0 &&
- lon*Proj4js.common.R2D < -180.0) {
- Proj4js.reportError("merc:forward: llInputOutOfRange: "+ lon +" : " + lat);
- return null;
- }
-
- var x,y;
- if(Math.abs( Math.abs(lat) - Proj4js.common.HALF_PI) <= Proj4js.common.EPSLN) {
- Proj4js.reportError("merc:forward: ll2mAtPoles");
- return null;
- } else {
- if (this.sphere) {
- x = this.x0 + this.a * this.k0 * Proj4js.common.adjust_lon(lon - this.long0);
- y = this.y0 + this.a * this.k0 * Math.log(Math.tan(Proj4js.common.FORTPI + 0.5*lat));
- } else {
- var sinphi = Math.sin(lat);
- var ts = Proj4js.common.tsfnz(this.e,lat,sinphi);
- x = this.x0 + this.a * this.k0 * Proj4js.common.adjust_lon(lon - this.long0);
- y = this.y0 - this.a * this.k0 * Math.log(ts);
- }
- p.x = x;
- p.y = y;
- return p;
- }
- },
-
-
- /* Mercator inverse equations--mapping x,y to lat/long
- --------------------------------------------------*/
- inverse : function(p) {
-
- var x = p.x - this.x0;
- var y = p.y - this.y0;
- var lon,lat;
-
- if (this.sphere) {
- lat = Proj4js.common.HALF_PI - 2.0 * Math.atan(Math.exp(-y / this.a * this.k0));
- } else {
- var ts = Math.exp(-y / (this.a * this.k0));
- lat = Proj4js.common.phi2z(this.e,ts);
- if(lat == -9999) {
- Proj4js.reportError("merc:inverse: lat = -9999");
- return null;
- }
- }
- lon = Proj4js.common.adjust_lon(this.long0+ x / (this.a * this.k0));
-
- p.x = lon;
- p.y = lat;
- return p;
- }
-};
-
-
diff --git a/lib/proj4js-1.1.0-1/proj4js.js b/lib/proj4js-1.1.0-1/proj4js.js
deleted file mode 100644
index 2f7f94bcb..000000000
--- a/lib/proj4js-1.1.0-1/proj4js.js
+++ /dev/null
@@ -1,1816 +0,0 @@
-/*
-Author: Mike Adair madairATdmsolutions.ca
- Richard Greenwood [email protected]
-License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
-
-$Id: Proj.js 2956 2007-07-09 12:17:52Z steven $
-*/
-
-/**
- * Namespace: Proj4js
- *
- * Proj4js is a JavaScript library to transform point coordinates from one
- * coordinate system to another, including datum transformations.
- *
- * This library is a port of both the Proj.4 and GCTCP C libraries to JavaScript.
- * Enabling these transformations in the browser allows geographic data stored
- * in different projections to be combined in browser-based web mapping
- * applications.
- *
- * Proj4js must have access to coordinate system initialization strings (which
- * are the same as for PROJ.4 command line). Thes can be included in your
- * application using a <script> tag or Proj4js can load CS initialization
- * strings from a local directory or a web service such as spatialreference.org.
- *
- * Similarly, Proj4js must have access to projection transform code. These can
- * be included individually using a <script> tag in your page, built into a
- * custom build of Proj4js or loaded dynamically at run-time. Using the
- * -combined and -compressed versions of Proj4js includes all projection class
- * code by default.
- *
- * Note that dynamic loading of defs and code happens ascynchrously, check the
- * Proj.readyToUse flag before using the Proj object. If the defs and code
- * required by your application are loaded through script tags, dynamic loading
- * is not required and the Proj object will be readyToUse on return from the
- * constructor.
- *
- * All coordinates are handled as points which have a .x and a .y property
- * which will be modified in place.
- *
- * Override Proj4js.reportError for output of alerts and warnings.
- *
- * See http://trac.osgeo.org/proj4js/wiki/UserGuide for full details.
-*/
-
-/**
- * Global namespace object for Proj4js library
- */
-var Proj4js = {
-
- /**
- * Property: defaultDatum
- * The datum to use when no others a specified
- */
- defaultDatum: 'WGS84', //default datum
-
- /**
- * Method: transform(source, dest, point)
- * Transform a point coordinate from one map projection to another. This is
- * really the only public method you should need to use.
- *
- * Parameters:
- * source - {Proj4js.Proj} source map projection for the transformation
- * dest - {Proj4js.Proj} destination map projection for the transformation
- * point - {Object} point to transform, may be geodetic (long, lat) or
- * projected Cartesian (x,y), but should always have x,y properties.
- */
- transform: function(source, dest, point) {
- if (!source.readyToUse) {
- this.reportError("Proj4js initialization for:"+source.srsCode+" not yet complete");
- return point;
- }
- if (!dest.readyToUse) {
- this.reportError("Proj4js initialization for:"+dest.srsCode+" not yet complete");
- return point;
- }
-
- // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84
- if (source.datum && dest.datum && (
- ((source.datum.datum_type == Proj4js.common.PJD_3PARAM || source.datum.datum_type == Proj4js.common.PJD_7PARAM) && dest.datumCode != "WGS84") ||
- ((dest.datum.datum_type == Proj4js.common.PJD_3PARAM || dest.datum.datum_type == Proj4js.common.PJD_7PARAM) && source.datumCode != "WGS84"))) {
- var wgs84 = Proj4js.WGS84;
- this.transform(source, wgs84, point);
- source = wgs84;
- }
-
- // DGR, 2010/11/12
- if (source.axis!="enu") {
- this.adjust_axis(source,false,point);
- }
-
- // Transform source points to long/lat, if they aren't already.
- if ( source.projName=="longlat") {
- point.x *= Proj4js.common.D2R; // convert degrees to radians
- point.y *= Proj4js.common.D2R;
- } else {
- if (source.to_meter) {
- point.x *= source.to_meter;
- point.y *= source.to_meter;
- }
- source.inverse(point); // Convert Cartesian to longlat
- }
-
- // Adjust for the prime meridian if necessary
- if (source.from_greenwich) {
- point.x += source.from_greenwich;
- }
-
- // Convert datums if needed, and if possible.
- point = this.datum_transform( source.datum, dest.datum, point );
-
- // Adjust for the prime meridian if necessary
- if (dest.from_greenwich) {
- point.x -= dest.from_greenwich;
- }
-
- if( dest.projName=="longlat" ) {
- // convert radians to decimal degrees
- point.x *= Proj4js.common.R2D;
- point.y *= Proj4js.common.R2D;
- } else { // else project
- dest.forward(point);
- if (dest.to_meter) {
- point.x /= dest.to_meter;
- point.y /= dest.to_meter;
- }
- }
-
- // DGR, 2010/11/12
- if (dest.axis!="enu") {
- this.adjust_axis(dest,true,point);
- }
-
- return point;
- }, // transform()
-
- /** datum_transform()
- source coordinate system definition,
- destination coordinate system definition,
- point to transform in geodetic coordinates (long, lat, height)
- */
- datum_transform : function( source, dest, point ) {
-
- // Short cut if the datums are identical.
- if( source.compare_datums( dest ) ) {
- return point; // in this case, zero is sucess,
- // whereas cs_compare_datums returns 1 to indicate TRUE
- // confusing, should fix this
- }
-
- // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest
- if( source.datum_type == Proj4js.common.PJD_NODATUM
- || dest.datum_type == Proj4js.common.PJD_NODATUM) {
- return point;
- }
-
- // Do we need to go through geocentric coordinates?
- if( source.es != dest.es || source.a != dest.a
- || source.datum_type == Proj4js.common.PJD_3PARAM
- || source.datum_type == Proj4js.common.PJD_7PARAM
- || dest.datum_type == Proj4js.common.PJD_3PARAM
- || dest.datum_type == Proj4js.common.PJD_7PARAM)
- {
-
- // Convert to geocentric coordinates.
- source.geodetic_to_geocentric( point );
- // CHECK_RETURN;
-
- // Convert between datums
- if( source.datum_type == Proj4js.common.PJD_3PARAM || source.datum_type == Proj4js.common.PJD_7PARAM ) {
- source.geocentric_to_wgs84(point);
- // CHECK_RETURN;
- }
-
- if( dest.datum_type == Proj4js.common.PJD_3PARAM || dest.datum_type == Proj4js.common.PJD_7PARAM ) {
- dest.geocentric_from_wgs84(point);
- // CHECK_RETURN;
- }
-
- // Convert back to geodetic coordinates
- dest.geocentric_to_geodetic( point );
- // CHECK_RETURN;
- }
-
- return point;
- }, // cs_datum_transform
-
- /**
- * Function: adjust_axis
- * Normalize or de-normalized the x/y/z axes. The normal form is "enu"
- * (easting, northing, up).
- * Parameters:
- * crs {Proj4js.Proj} the coordinate reference system
- * denorm {Boolean} when false, normalize
- * point {Object} the coordinates to adjust
- */
- adjust_axis: function(crs, denorm, point) {
- var xin= point.x, yin= point.y, zin= point.z || 0.0;
- var v, t;
- for (var i= 0; i<3; i++) {
- if (denorm && i==2 && point.z===undefined) { continue; }
- if (i==0) { v= xin; t= 'x'; }
- else if (i==1) { v= yin; t= 'y'; }
- else { v= zin; t= 'z'; }
- switch(crs.axis[i]) {
- case 'e':
- point[t]= v;
- break;
- case 'w':
- point[t]= -v;
- break;
- case 'n':
- point[t]= v;
- break;
- case 's':
- point[t]= -v;
- break;
- case 'u':
- if (point[t]!==undefined) { point.z= v; }
- break;
- case 'd':
- if (point[t]!==undefined) { point.z= -v; }
- break;
- default :
- alert("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName);
- return null;
- }
- }
- return point;
- },
-
- /**
- * Function: reportError
- * An internal method to report errors back to user.
- * Override this in applications to report error messages or throw exceptions.
- */
- reportError: function(msg) {
- //console.log(msg);
- },
-
-/**
- *
- * Title: Private Methods
- * The following properties and methods are intended for internal use only.
- *
- * This is a minimal implementation of JavaScript inheritance methods so that
- * Proj4js can be used as a stand-alone library.
- * These are copies of the equivalent OpenLayers methods at v2.7
- */
-
-/**
- * Function: extend
- * Copy all properties of a source object to a destination object. Modifies
- * the passed in destination object. Any properties on the source object
- * that are set to undefined will not be (re)set on the destination object.
- *
- * Parameters:
- * destination - {Object} The object that will be modified
- * source - {Object} The object with properties to be set on the destination
- *
- * Returns:
- * {Object} The destination object.
- */
- extend: function(destination, source) {
- destination = destination || {};
- if(source) {
- for(var property in source) {
- var value = source[property];
- if(value !== undefined) {
- destination[property] = value;
- }
- }
- }
- return destination;
- },
-
-/**
- * Constructor: Class
- * Base class used to construct all other classes. Includes support for
- * multiple inheritance.
- *
- */
- Class: function() {
- var Class = function() {
- this.initialize.apply(this, arguments);
- };
-
- var extended = {};
- var parent;
- for(var i=0; i<arguments.length; ++i) {
- if(typeof arguments[i] == "function") {
- // get the prototype of the superclass
- parent = arguments[i].prototype;
- } else {
- // in this case we're extending with the prototype
- parent = arguments[i];
- }
- Proj4js.extend(extended, parent);
- }
- Class.prototype = extended;
-
- return Class;
- },
-
- /**
- * Function: bind
- * Bind a function to an object. Method to easily create closures with
- * 'this' altered.
- *
- * Parameters:
- * func - {Function} Input function.
- * object - {Object} The object to bind to the input function (as this).
- *
- * Returns:
- * {Function} A closure with 'this' set to the passed in object.
- */
- bind: function(func, object) {
- // create a reference to all arguments past the second one
- var args = Array.prototype.slice.apply(arguments, [2]);
- return function() {
- // Push on any additional arguments from the actual function call.
- // These will come after those sent to the bind call.
- var newArgs = args.concat(
- Array.prototype.slice.apply(arguments, [0])
- );
- return func.apply(object, newArgs);
- };
- },
-
-/**
- * The following properties and methods handle dynamic loading of JSON objects.
- */
-
- /**
- * Property: scriptName
- * {String} The filename of this script without any path.
- */
- scriptName: "proj4js.js",
-
- /**
- * Property: defsLookupService
- * AJAX service to retreive projection definition parameters from
- */
- defsLookupService: 'http://spatialreference.org/ref',
-
- /**
- * Property: libPath
- * internal: http server path to library code.
- */
- libPath: null,
-
- /**
- * Function: getScriptLocation
- * Return the path to this script.
- *
- * Returns:
- * Path to this script
- */
- getScriptLocation: function () {
- if (this.libPath) return this.libPath;
- var scriptName = this.scriptName;
- var scriptNameLen = scriptName.length;
-
- var scripts = document.getElementsByTagName('script');
- for (var i = 0; i < scripts.length; i++) {
- var src = scripts[i].getAttribute('src');
- if (src) {
- var index = src.lastIndexOf(scriptName);
- // is it found, at the end of the URL?
- if ((index > -1) && (index + scriptNameLen == src.length)) {
- this.libPath = src.slice(0, -scriptNameLen);
- break;
- }
- }
- }
- return this.libPath||"";
- },
-
- /**
- * Function: loadScript
- * Load a JS file from a URL into a <script> tag in the page.
- *
- * Parameters:
- * url - {String} The URL containing the script to load
- * onload - {Function} A method to be executed when the script loads successfully
- * onfail - {Function} A method to be executed when there is an error loading the script
- * loadCheck - {Function} A boolean method that checks to see if the script
- * has loaded. Typically this just checks for the existance of
- * an object in the file just loaded.
- */
- loadScript: function(url, onload, onfail, loadCheck) {
- var script = document.createElement('script');
- script.defer = false;
- script.type = "text/javascript";
- script.id = url;
- script.src = url;
- script.onload = onload;
- script.onerror = onfail;
- script.loadCheck = loadCheck;
- if (/MSIE/.test(navigator.userAgent)) {
- script.onreadystatechange = this.checkReadyState;
- }
- document.getElementsByTagName('head')[0].appendChild(script);
- },
-
- /**
- * Function: checkReadyState
- * IE workaround since there is no onerror handler. Calls the user defined
- * loadCheck method to determine if the script is loaded.
- *
- */
- checkReadyState: function() {
- if (this.readyState == 'loaded') {
- if (!this.loadCheck()) {
- this.onerror();
- } else {
- this.onload();
- }
- }
- }
-};
-
-/**
- * Class: Proj4js.Proj
- *
- * Proj objects provide transformation methods for point coordinates
- * between geodetic latitude/longitude and a projected coordinate system.
- * once they have been initialized with a projection code.
- *
- * Initialization of Proj objects is with a projection code, usually EPSG codes,
- * which is the key that will be used with the Proj4js.defs array.
- *
- * The code passed in will be stripped of colons and converted to uppercase
- * to locate projection definition files.
- *
- * A projection object has properties for units and title strings.
- */
-Proj4js.Proj = Proj4js.Class({
-
- /**
- * Property: readyToUse
- * Flag to indicate if initialization is complete for this Proj object
- */
- readyToUse: false,
-
- /**
- * Property: title
- * The title to describe the projection
- */
- title: null,
-
- /**
- * Property: projName
- * The projection class for this projection, e.g. lcc (lambert conformal conic,
- * or merc for mercator). These are exactly equivalent to their Proj4
- * counterparts.
- */
- projName: null,
- /**
- * Property: units
- * The units of the projection. Values include 'm' and 'degrees'
- */
- units: null,
- /**
- * Property: datum
- * The datum specified for the projection
- */
- datum: null,
- /**
- * Property: x0
- * The x coordinate origin
- */
- x0: 0,
- /**
- * Property: y0
- * The y coordinate origin
- */
- y0: 0,
- /**
- * Property: localCS
- * Flag to indicate if the projection is a local one in which no transforms
- * are required.
- */
- localCS: false,
-
- /**
- * Property: queue
- * Buffer (FIFO) to hold callbacks waiting to be called when projection loaded.
- */
- queue: null,
-
- /**
- * Constructor: initialize
- * Constructor for Proj4js.Proj objects
- *
- * Parameters:
- * srsCode - a code for map projection definition parameters. These are usually
- * (but not always) EPSG codes.
- */
- initialize: function(srsCode, callback) {
- this.srsCodeInput = srsCode;
-
- //Register callbacks prior to attempting to process definition
- this.queue = [];
- if( callback ){
- this.queue.push( callback );
- }
-
- //check to see if this is a WKT string
- if ((srsCode.indexOf('GEOGCS') >= 0) ||
- (srsCode.indexOf('GEOCCS') >= 0) ||
- (srsCode.indexOf('PROJCS') >= 0) ||
- (srsCode.indexOf('LOCAL_CS') >= 0)) {
- this.parseWKT(srsCode);
- this.deriveConstants();
- this.loadProjCode(this.projName);
- return;
- }
-
- // DGR 2008-08-03 : support urn and url
- if (srsCode.indexOf('urn:') == 0) {
- //urn:ORIGINATOR:def:crs:CODESPACE:VERSION:ID
- var urn = srsCode.split(':');
- if ((urn[1] == 'ogc' || urn[1] =='x-ogc') &&
- (urn[2] =='def') &&
- (urn[3] =='crs')) {
- srsCode = urn[4]+':'+urn[urn.length-1];
- }
- } else if (srsCode.indexOf('http://') == 0) {
- //url#ID
- var url = srsCode.split('#');
- if (url[0].match(/epsg.org/)) {
- // http://www.epsg.org/#
- srsCode = 'EPSG:'+url[1];
- } else if (url[0].match(/RIG.xml/)) {
- //http://librairies.ign.fr/geoportail/resources/RIG.xml#
- //http://interop.ign.fr/registers/ign/RIG.xml#
- srsCode = 'IGNF:'+url[1];
- }
- }
- this.srsCode = srsCode.toUpperCase();
- if (this.srsCode.indexOf("EPSG") == 0) {
- this.srsCode = this.srsCode;
- this.srsAuth = 'epsg';
- this.srsProjNumber = this.srsCode.substring(5);
- // DGR 2007-11-20 : authority IGNF
- } else if (this.srsCode.indexOf("IGNF") == 0) {
- this.srsCode = this.srsCode;
- this.srsAuth = 'IGNF';
- this.srsProjNumber = this.srsCode.substring(5);
- // DGR 2008-06-19 : pseudo-authority CRS for WMS
- } else if (this.srsCode.indexOf("CRS") == 0) {
- this.srsCode = this.srsCode;
- this.srsAuth = 'CRS';
- this.srsProjNumber = this.srsCode.substring(4);
- } else {
- this.srsAuth = '';
- this.srsProjNumber = this.srsCode;
- }
-
- this.loadProjDefinition();
- },
-
-/**
- * Function: loadProjDefinition
- * Loads the coordinate system initialization string if required.
- * Note that dynamic loading happens asynchronously so an application must
- * wait for the readyToUse property is set to true.
- * To prevent dynamic loading, include the defs through a script tag in
- * your application.
- *
- */
- loadProjDefinition: function() {
- //check in memory
- if (Proj4js.defs[this.srsCode]) {
- this.defsLoaded();
- return;
- }
-
- //else check for def on the server
- var url = Proj4js.getScriptLocation() + 'defs/' + this.srsAuth.toUpperCase() + this.srsProjNumber + '.js';
- Proj4js.loadScript(url,
- Proj4js.bind(this.defsLoaded, this),
- Proj4js.bind(this.loadFromService, this),
- Proj4js.bind(this.checkDefsLoaded, this) );
- },
-
-/**
- * Function: loadFromService
- * Creates the REST URL for loading the definition from a web service and
- * loads it.
- *
- */
- loadFromService: function() {
- //else load from web service
- var url = Proj4js.defsLookupService +'/' + this.srsAuth +'/'+ this.srsProjNumber + '/proj4js/';
- Proj4js.loadScript(url,
- Proj4js.bind(this.defsLoaded, this),
- Proj4js.bind(this.defsFailed, this),
- Proj4js.bind(this.checkDefsLoaded, this) );
- },
-
-/**
- * Function: defsLoaded
- * Continues the Proj object initilization once the def file is loaded
- *
- */
- defsLoaded: function() {
- this.parseDefs();
- this.loadProjCode(this.projName);
- },
-
-/**
- * Function: checkDefsLoaded
- * This is the loadCheck method to see if the def object exists
- *
- */
- checkDefsLoaded: function() {
- if (Proj4js.defs[this.srsCode]) {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Function: defsFailed
- * Report an error in loading the defs file, but continue on using WGS84
- *
- */
- defsFailed: function() {
- Proj4js.reportError('failed to load projection definition for: '+this.srsCode);
- Proj4js.defs[this.srsCode] = Proj4js.defs['WGS84']; //set it to something so it can at least continue
- this.defsLoaded();
- },
-
-/**
- * Function: loadProjCode
- * Loads projection class code dynamically if required.
- * Projection code may be included either through a script tag or in
- * a built version of proj4js
- *
- */
- loadProjCode: function(projName) {
- if (Proj4js.Proj[projName]) {
- this.initTransforms();
- return;
- }
-
- //the URL for the projection code
- var url = Proj4js.getScriptLocation() + 'projCode/' + projName + '.js';
- Proj4js.loadScript(url,
- Proj4js.bind(this.loadProjCodeSuccess, this, projName),
- Proj4js.bind(this.loadProjCodeFailure, this, projName),
- Proj4js.bind(this.checkCodeLoaded, this, projName) );
- },
-
- /**
- * Function: loadProjCodeSuccess
- * Loads any proj dependencies or continue on to final initialization.
- *
- */
- loadProjCodeSuccess: function(projName) {
- if (Proj4js.Proj[projName].dependsOn){
- this.loadProjCode(Proj4js.Proj[projName].dependsOn);
- } else {
- this.initTransforms();
- }
- },
-
- /**
- * Function: defsFailed
- * Report an error in loading the proj file. Initialization of the Proj
- * object has failed and the readyToUse flag will never be set.
- *
- */
- loadProjCodeFailure: function(projName) {
- Proj4js.reportError("failed to find projection file for: " + projName);
- //TBD initialize with identity transforms so proj will still work?
- },
-
-/**
- * Function: checkCodeLoaded
- * This is the loadCheck method to see if the projection code is loaded
- *
- */
- checkCodeLoaded: function(projName) {
- if (Proj4js.Proj[projName]) {
- return true;
- } else {
- return false;
- }
- },
-
-/**
- * Function: initTransforms
- * Finalize the initialization of the Proj object
- *
- */
- initTransforms: function() {
- Proj4js.extend(this, Proj4js.Proj[this.projName]);
- this.init();
- this.readyToUse = true;
- if( this.queue ) {
- var item;
- while( (item = this.queue.shift()) ) {
- item.call( this, this );
- }
- }
- },
-
-/**
- * Function: parseWKT
- * Parses a WKT string to get initialization parameters
- *
- */
- wktRE: /^(\w+)\[(.*)\]$/,
- parseWKT: function(wkt) {
- var wktMatch = wkt.match(this.wktRE);
- if (!wktMatch) return;
- var wktObject = wktMatch[1];
- var wktContent = wktMatch[2];
- var wktTemp = wktContent.split(",");
- var wktName;
- if (wktObject.toUpperCase() == "TOWGS84") {
- wktName = wktObject; //no name supplied for the TOWGS84 array
- } else {
- wktName = wktTemp.shift();
- }
- wktName = wktName.replace(/^\"/,"");
- wktName = wktName.replace(/\"$/,"");
-
- /*
- wktContent = wktTemp.join(",");
- var wktArray = wktContent.split("],");
- for (var i=0; i<wktArray.length-1; ++i) {
- wktArray[i] += "]";
- }
- */
-
- var wktArray = new Array();
- var bkCount = 0;
- var obj = "";
- for (var i=0; i<wktTemp.length; ++i) {
- var token = wktTemp[i];
- for (var j=0; j<token.length; ++j) {
- if (token.charAt(j) == "[") ++bkCount;
- if (token.charAt(j) == "]") --bkCount;
- }
- obj += token;
- if (bkCount === 0) {
- wktArray.push(obj);
- obj = "";
- } else {
- obj += ",";
- }
- }
-
- //do something based on the type of the wktObject being parsed
- //add in variations in the spelling as required
- switch (wktObject) {
- case 'LOCAL_CS':
- this.projName = 'identity'
- this.localCS = true;
- this.srsCode = wktName;
- break;
- case 'GEOGCS':
- this.projName = 'longlat'
- this.geocsCode = wktName;
- if (!this.srsCode) this.srsCode = wktName;
- break;
- case 'PROJCS':
- this.srsCode = wktName;
- break;
- case 'GEOCCS':
- break;
- case 'PROJECTION':
- this.projName = Proj4js.wktProjections[wktName]
- break;
- case 'DATUM':
- this.datumName = wktName;
- break;
- case 'LOCAL_DATUM':
- this.datumCode = 'none';
- break;
- case 'SPHEROID':
- this.ellps = wktName;
- this.a = parseFloat(wktArray.shift());
- this.rf = parseFloat(wktArray.shift());
- break;
- case 'PRIMEM':
- this.from_greenwich = parseFloat(wktArray.shift()); //to radians?
- break;
- case 'UNIT':
- this.units = wktName;
- this.unitsPerMeter = parseFloat(wktArray.shift());
- break;
- case 'PARAMETER':
- var name = wktName.toLowerCase();
- var value = parseFloat(wktArray.shift());
- //there may be many variations on the wktName values, add in case
- //statements as required
- switch (name) {
- case 'false_easting':
- this.x0 = value;
- break;
- case 'false_northing':
- this.y0 = value;
- break;
- case 'scale_factor':
- this.k0 = value;
- break;
- case 'central_meridian':
- this.long0 = value*Proj4js.common.D2R;
- break;
- case 'latitude_of_origin':
- this.lat0 = value*Proj4js.common.D2R;
- break;
- case 'more_here':
- break;
- default:
- break;
- }
- break;
- case 'TOWGS84':
- this.datum_params = wktArray;
- break;
- //DGR 2010-11-12: AXIS
- case 'AXIS':
- var name= wktName.toLowerCase();
- var value= wktArray.shift();
- switch (value) {
- case 'EAST' : value= 'e'; break;
- case 'WEST' : value= 'w'; break;
- case 'NORTH': value= 'n'; break;
- case 'SOUTH': value= 's'; break;
- case 'UP' : value= 'u'; break;
- case 'DOWN' : value= 'd'; break;
- case 'OTHER':
- default : value= ' '; break;//FIXME
- }
- if (!this.axis) { this.axis= "enu"; }
- switch(name) {
- case 'x': this.axis= value + this.axis.substr(1,2); break;
- case 'y': this.axis= this.axis.substr(0,1) + value + this.axis.substr(2,1); break;
- case 'z': this.axis= this.axis.substr(0,2) + value ; break;
- default : break;
- }
- case 'MORE_HERE':
- break;
- default:
- break;
- }
- for (var i=0; i<wktArray.length; ++i) {
- this.parseWKT(wktArray[i]);
- }
- },
-
-/**
- * Function: parseDefs
- * Parses the PROJ.4 initialization string and sets the associated properties.
- *
- */
- parseDefs: function() {
- this.defData = Proj4js.defs[this.srsCode];
- var paramName, paramVal;
- if (!this.defData) {
- return;
- }
- var paramArray=this.defData.split("+");
-
- for (var prop=0; prop<paramArray.length; prop++) {
- var property = paramArray[prop].split("=");
- paramName = property[0].toLowerCase();
- paramVal = property[1];
-
- switch (paramName.replace(/\s/gi,"")) { // trim out spaces
- case "": break; // throw away nameless parameter
- case "title": this.title = paramVal; break;
- case "proj": this.projName = paramVal.replace(/\s/gi,""); break;
- case "units": this.units = paramVal.replace(/\s/gi,""); break;
- case "datum": this.datumCode = paramVal.replace(/\s/gi,""); break;
- case "nadgrids": this.nagrids = paramVal.replace(/\s/gi,""); break;
- case "ellps": this.ellps = paramVal.replace(/\s/gi,""); break;
- case "a": this.a = parseFloat(paramVal); break; // semi-major radius
- case "b": this.b = parseFloat(paramVal); break; // semi-minor radius
- // DGR 2007-11-20
- case "rf": this.rf = parseFloat(paramVal); break; // inverse flattening rf= a/(a-b)
- case "lat_0": this.lat0 = paramVal*Proj4js.common.D2R; break; // phi0, central latitude
- case "lat_1": this.lat1 = paramVal*Proj4js.common.D2R; break; //standard parallel 1
- case "lat_2": this.lat2 = paramVal*Proj4js.common.D2R; break; //standard parallel 2
- case "lat_ts": this.lat_ts = paramVal*Proj4js.common.D2R; break; // used in merc and eqc
- case "lon_0": this.long0 = paramVal*Proj4js.common.D2R; break; // lam0, central longitude
- case "alpha": this.alpha = parseFloat(paramVal)*Proj4js.common.D2R; break; //for somerc projection
- case "lonc": this.longc = paramVal*Proj4js.common.D2R; break; //for somerc projection
- case "x_0": this.x0 = parseFloat(paramVal); break; // false easting
- case "y_0": this.y0 = parseFloat(paramVal); break; // false northing
- case "k_0": this.k0 = parseFloat(paramVal); break; // projection scale factor
- case "k": this.k0 = parseFloat(paramVal); break; // both forms returned
- case "r_a": this.R_A = true; break; // sphere--area of ellipsoid
- case "zone": this.zone = parseInt(paramVal,10); break; // UTM Zone
- case "south": this.utmSouth = true; break; // UTM north/south
- case "towgs84":this.datum_params = paramVal.split(","); break;
- case "to_meter": this.to_meter = parseFloat(paramVal); break; // cartesian scaling
- case "from_greenwich": this.from_greenwich = paramVal*Proj4js.common.D2R; break;
- // DGR 2008-07-09 : if pm is not a well-known prime meridian take
- // the value instead of 0.0, then convert to radians
- case "pm": paramVal = paramVal.replace(/\s/gi,"");
- this.from_greenwich = Proj4js.PrimeMeridian[paramVal] ?
- Proj4js.PrimeMeridian[paramVal] : parseFloat(paramVal);
- this.from_greenwich *= Proj4js.common.D2R;
- break;
- // DGR 2010-11-12: axis
- case "axis": paramVal = paramVal.replace(/\s/gi,"");
- var legalAxis= "ewnsud";
- if (paramVal.length==3 &&
- legalAxis.indexOf(paramVal.substr(0,1))!=-1 &&
- legalAxis.indexOf(paramVal.substr(1,1))!=-1 &&
- legalAxis.indexOf(paramVal.substr(2,1))!=-1) {
- this.axis= paramVal;
- } //FIXME: be silent ?
- break
- case "no_defs": break;
- default: //alert("Unrecognized parameter: " + paramName);
- } // switch()
- } // for paramArray
- this.deriveConstants();
- },
-
-/**
- * Function: deriveConstants
- * Sets several derived constant values and initialization of datum and ellipse
- * parameters.
- *
- */
- deriveConstants: function() {
- if (this.nagrids == '@null') this.datumCode = 'none';
- if (this.datumCode && this.datumCode != 'none') {
- var datumDef = Proj4js.Datum[this.datumCode];
- if (datumDef) {
- this.datum_params = datumDef.towgs84 ? datumDef.towgs84.split(',') : null;
- this.ellps = datumDef.ellipse;
- this.datumName = datumDef.datumName ? datumDef.datumName : this.datumCode;
- }
- }
- if (!this.a) { // do we have an ellipsoid?
- var ellipse = Proj4js.Ellipsoid[this.ellps] ? Proj4js.Ellipsoid[this.ellps] : Proj4js.Ellipsoid['WGS84'];
- Proj4js.extend(this, ellipse);
- }
- if (this.rf && !this.b) this.b = (1.0 - 1.0/this.rf) * this.a;
- if (this.rf === 0 || Math.abs(this.a - this.b)<Proj4js.common.EPSLN) {
- this.sphere = true;
- this.b= this.a;
- }
- this.a2 = this.a * this.a; // used in geocentric
- this.b2 = this.b * this.b; // used in geocentric
- this.es = (this.a2-this.b2)/this.a2; // e ^ 2
- this.e = Math.sqrt(this.es); // eccentricity
- if (this.R_A) {
- this.a *= 1. - this.es * (Proj4js.common.SIXTH + this.es * (Proj4js.common.RA4 + this.es * Proj4js.common.RA6));
- this.a2 = this.a * this.a;
- this.b2 = this.b * this.b;
- this.es = 0.;
- }
- this.ep2=(this.a2-this.b2)/this.b2; // used in geocentric
- if (!this.k0) this.k0 = 1.0; //default value
- //DGR 2010-11-12: axis
- if (!this.axis) { this.axis= "enu"; }
-
- this.datum = new Proj4js.datum(this);
- }
-});
-
-Proj4js.Proj.longlat = {
- init: function() {
- //no-op for longlat
- },
- forward: function(pt) {
- //identity transform
- return pt;
- },
- inverse: function(pt) {
- //identity transform
- return pt;
- }
-};
-Proj4js.Proj.identity = Proj4js.Proj.longlat;
-
-/**
- Proj4js.defs is a collection of coordinate system definition objects in the
- PROJ.4 command line format.
- Generally a def is added by means of a separate .js file for example:
-
- <SCRIPT type="text/javascript" src="defs/EPSG26912.js"></SCRIPT>
-
- def is a CS definition in PROJ.4 WKT format, for example:
- +proj="tmerc" //longlat, etc.
- +a=majorRadius
- +b=minorRadius
- +lat0=somenumber
- +long=somenumber
-*/
-Proj4js.defs = {
- // These are so widely used, we'll go ahead and throw them in
- // without requiring a separate .js file
- 'WGS84': "+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees",
- 'EPSG:4326': "+title=long/lat:WGS84 +proj=longlat +a=6378137.0 +b=6356752.31424518 +ellps=WGS84 +datum=WGS84 +units=degrees",
- 'EPSG:4269': "+title=long/lat:NAD83 +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees",
- 'EPSG:3875': "+title= Google Mercator +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 +no_defs"
-};
-Proj4js.defs['EPSG:3785'] = Proj4js.defs['EPSG:3875']; //maintain backward compat, official code is 3875
-Proj4js.defs['GOOGLE'] = Proj4js.defs['EPSG:3875'];
-Proj4js.defs['EPSG:900913'] = Proj4js.defs['EPSG:3875'];
-Proj4js.defs['EPSG:102113'] = Proj4js.defs['EPSG:3875'];
-
-Proj4js.common = {
- PI : 3.141592653589793238, //Math.PI,
- HALF_PI : 1.570796326794896619, //Math.PI*0.5,
- TWO_PI : 6.283185307179586477, //Math.PI*2,
- FORTPI : 0.78539816339744833,
- R2D : 57.29577951308232088,
- D2R : 0.01745329251994329577,
- SEC_TO_RAD : 4.84813681109535993589914102357e-6, /* SEC_TO_RAD = Pi/180/3600 */
- EPSLN : 1.0e-10,
- MAX_ITER : 20,
- // following constants from geocent.c
- COS_67P5 : 0.38268343236508977, /* cosine of 67.5 degrees */
- AD_C : 1.0026000, /* Toms region 1 constant */
-
- /* datum_type values */
- PJD_UNKNOWN : 0,
- PJD_3PARAM : 1,
- PJD_7PARAM : 2,
- PJD_GRIDSHIFT: 3,
- PJD_WGS84 : 4, // WGS84 or equivalent
- PJD_NODATUM : 5, // WGS84 or equivalent
- SRS_WGS84_SEMIMAJOR : 6378137.0, // only used in grid shift transforms
-
- // ellipoid pj_set_ell.c
- SIXTH : .1666666666666666667, /* 1/6 */
- RA4 : .04722222222222222222, /* 17/360 */
- RA6 : .02215608465608465608, /* 67/3024 */
- RV4 : .06944444444444444444, /* 5/72 */
- RV6 : .04243827160493827160, /* 55/1296 */
-
-// Function to compute the constant small m which is the radius of
-// a parallel of latitude, phi, divided by the semimajor axis.
-// -----------------------------------------------------------------
- msfnz : function(eccent, sinphi, cosphi) {
- var con = eccent * sinphi;
- return cosphi/(Math.sqrt(1.0 - con * con));
- },
-
-// Function to compute the constant small t for use in the forward
-// computations in the Lambert Conformal Conic and the Polar
-// Stereographic projections.
-// -----------------------------------------------------------------
- tsfnz : function(eccent, phi, sinphi) {
- var con = eccent * sinphi;
- var com = .5 * eccent;
- con = Math.pow(((1.0 - con) / (1.0 + con)), com);
- return (Math.tan(.5 * (this.HALF_PI - phi))/con);
- },
-
-// Function to compute the latitude angle, phi2, for the inverse of the
-// Lambert Conformal Conic and Polar Stereographic projections.
-// ----------------------------------------------------------------
- phi2z : function(eccent, ts) {
- var eccnth = .5 * eccent;
- var con, dphi;
- var phi = this.HALF_PI - 2 * Math.atan(ts);
- for (var i = 0; i <= 15; i++) {
- con = eccent * Math.sin(phi);
- dphi = this.HALF_PI - 2 * Math.atan(ts *(Math.pow(((1.0 - con)/(1.0 + con)),eccnth))) - phi;
- phi += dphi;
- if (Math.abs(dphi) <= .0000000001) return phi;
- }
- alert("phi2z has NoConvergence");
- return (-9999);
- },
-
-/* Function to compute constant small q which is the radius of a
- parallel of latitude, phi, divided by the semimajor axis.
-------------------------------------------------------------*/
- qsfnz : function(eccent,sinphi) {
- var con;
- if (eccent > 1.0e-7) {
- con = eccent * sinphi;
- return (( 1.0- eccent * eccent) * (sinphi /(1.0 - con * con) - (.5/eccent)*Math.log((1.0 - con)/(1.0 + con))));
- } else {
- return(2.0 * sinphi);
- }
- },
-
-/* Function to eliminate roundoff errors in asin
-----------------------------------------------*/
- asinz : function(x) {
- if (Math.abs(x)>1.0) {
- x=(x>1.0)?1.0:-1.0;
- }
- return Math.asin(x);
- },
-
-// following functions from gctpc cproj.c for transverse mercator projections
- e0fn : function(x) {return(1.0-0.25*x*(1.0+x/16.0*(3.0+1.25*x)));},
- e1fn : function(x) {return(0.375*x*(1.0+0.25*x*(1.0+0.46875*x)));},
- e2fn : function(x) {return(0.05859375*x*x*(1.0+0.75*x));},
- e3fn : function(x) {return(x*x*x*(35.0/3072.0));},
- mlfn : function(e0,e1,e2,e3,phi) {return(e0*phi-e1*Math.sin(2.0*phi)+e2*Math.sin(4.0*phi)-e3*Math.sin(6.0*phi));},
-
- srat : function(esinp, exp) {
- return(Math.pow((1.0-esinp)/(1.0+esinp), exp));
- },
-
-// Function to return the sign of an argument
- sign : function(x) { if (x < 0.0) return(-1); else return(1);},
-
-// Function to adjust longitude to -180 to 180; input in radians
- adjust_lon : function(x) {
- x = (Math.abs(x) < this.PI) ? x: (x - (this.sign(x)*this.TWO_PI) );
- return x;
- },
-
-// IGNF - DGR : algorithms used by IGN France
-
-// Function to adjust latitude to -90 to 90; input in radians
- adjust_lat : function(x) {
- x= (Math.abs(x) < this.HALF_PI) ? x: (x - (this.sign(x)*this.PI) );
- return x;
- },
-
-// Latitude Isometrique - close to tsfnz ...
- latiso : function(eccent, phi, sinphi) {
- if (Math.abs(phi) > this.HALF_PI) return +Number.NaN;
- if (phi==this.HALF_PI) return Number.POSITIVE_INFINITY;
- if (phi==-1.0*this.HALF_PI) return -1.0*Number.POSITIVE_INFINITY;
-
- var con= eccent*sinphi;
- return Math.log(Math.tan((this.HALF_PI+phi)/2.0))+eccent*Math.log((1.0-con)/(1.0+con))/2.0;
- },
-
- fL : function(x,L) {
- return 2.0*Math.atan(x*Math.exp(L)) - this.HALF_PI;
- },
-
-// Inverse Latitude Isometrique - close to ph2z
- invlatiso : function(eccent, ts) {
- var phi= this.fL(1.0,ts);
- var Iphi= 0.0;
- var con= 0.0;
- do {
- Iphi= phi;
- con= eccent*Math.sin(Iphi);
- phi= this.fL(Math.exp(eccent*Math.log((1.0+con)/(1.0-con))/2.0),ts)
- } while (Math.abs(phi-Iphi)>1.0e-12);
- return phi;
- },
-
-// Needed for Gauss Schreiber
-// Original: Denis Makarov ([email protected])
-// Web Site: http://www.binarythings.com
- sinh : function(x)
- {
- var r= Math.exp(x);
- r= (r-1.0/r)/2.0;
- return r;
- },
-
- cosh : function(x)
- {
- var r= Math.exp(x);
- r= (r+1.0/r)/2.0;
- return r;
- },
-
- tanh : function(x)
- {
- var r= Math.exp(x);
- r= (r-1.0/r)/(r+1.0/r);
- return r;
- },
-
- asinh : function(x)
- {
- var s= (x>= 0? 1.0:-1.0);
- return s*(Math.log( Math.abs(x) + Math.sqrt(x*x+1.0) ));
- },
-
- acosh : function(x)
- {
- return 2.0*Math.log(Math.sqrt((x+1.0)/2.0) + Math.sqrt((x-1.0)/2.0));
- },
-
- atanh : function(x)
- {
- return Math.log((x-1.0)/(x+1.0))/2.0;
- },
-
-// Grande Normale
- gN : function(a,e,sinphi)
- {
- var temp= e*sinphi;
- return a/Math.sqrt(1.0 - temp*temp);
- },
-
- //code from the PROJ.4 pj_mlfn.c file; this may be useful for other projections
- pj_enfn: function(es) {
- var en = new Array();
- en[0] = this.C00 - es * (this.C02 + es * (this.C04 + es * (this.C06 + es * this.C08)));
- en[1] = es * (this.C22 - es * (this.C04 + es * (this.C06 + es * this.C08)));
- var t = es * es;
- en[2] = t * (this.C44 - es * (this.C46 + es * this.C48));
- t *= es;
- en[3] = t * (this.C66 - es * this.C68);
- en[4] = t * es * this.C88;
- return en;
- },
-
- pj_mlfn: function(phi, sphi, cphi, en) {
- cphi *= sphi;
- sphi *= sphi;
- return(en[0] * phi - cphi * (en[1] + sphi*(en[2]+ sphi*(en[3] + sphi*en[4]))));
- },
-
- pj_inv_mlfn: function(arg, es, en) {
- var k = 1./(1.-es);
- var phi = arg;
- for (var i = Proj4js.common.MAX_ITER; i ; --i) { /* rarely goes over 2 iterations */
- var s = Math.sin(phi);
- var t = 1. - es * s * s;
- //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;
- //phi -= t * (t * Math.sqrt(t)) * k;
- t = (this.pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;
- phi -= t;
- if (Math.abs(t) < Proj4js.common.EPSLN)
- return phi;
- }
- Proj4js.reportError("cass:pj_inv_mlfn: Convergence error");
- return phi;
- },
-
-/* meridinal distance for ellipsoid and inverse
-** 8th degree - accurate to < 1e-5 meters when used in conjuction
-** with typical major axis values.
-** Inverse determines phi to EPS (1e-11) radians, about 1e-6 seconds.
-*/
- C00: 1.0,
- C02: .25,
- C04: .046875,
- C06: .01953125,
- C08: .01068115234375,
- C22: .75,
- C44: .46875,
- C46: .01302083333333333333,
- C48: .00712076822916666666,
- C66: .36458333333333333333,
- C68: .00569661458333333333,
- C88: .3076171875
-
-};
-
-/** datum object
-*/
-Proj4js.datum = Proj4js.Class({
-
- initialize : function(proj) {
- this.datum_type = Proj4js.common.PJD_WGS84; //default setting
- if (proj.datumCode && proj.datumCode == 'none') {
- this.datum_type = Proj4js.common.PJD_NODATUM;
- }
- if (proj && proj.datum_params) {
- for (var i=0; i<proj.datum_params.length; i++) {
- proj.datum_params[i]=parseFloat(proj.datum_params[i]);
- }
- if (proj.datum_params[0] != 0 || proj.datum_params[1] != 0 || proj.datum_params[2] != 0 ) {
- this.datum_type = Proj4js.common.PJD_3PARAM;
- }
- if (proj.datum_params.length > 3) {
- if (proj.datum_params[3] != 0 || proj.datum_params[4] != 0 ||
- proj.datum_params[5] != 0 || proj.datum_params[6] != 0 ) {
- this.datum_type = Proj4js.common.PJD_7PARAM;
- proj.datum_params[3] *= Proj4js.common.SEC_TO_RAD;
- proj.datum_params[4] *= Proj4js.common.SEC_TO_RAD;
- proj.datum_params[5] *= Proj4js.common.SEC_TO_RAD;
- proj.datum_params[6] = (proj.datum_params[6]/1000000.0) + 1.0;
- }
- }
- }
- if (proj) {
- this.a = proj.a; //datum object also uses these values
- this.b = proj.b;
- this.es = proj.es;
- this.ep2 = proj.ep2;
- this.datum_params = proj.datum_params;
- }
- },
-
- /****************************************************************/
- // cs_compare_datums()
- // Returns TRUE if the two datums match, otherwise FALSE.
- compare_datums : function( dest ) {
- if( this.datum_type != dest.datum_type ) {
- return false; // false, datums are not equal
- } else if( this.a != dest.a || Math.abs(this.es-dest.es) > 0.000000000050 ) {
- // the tolerence for es is to ensure that GRS80 and WGS84
- // are considered identical
- return false;
- } else if( this.datum_type == Proj4js.common.PJD_3PARAM ) {
- return (this.datum_params[0] == dest.datum_params[0]
- && this.datum_params[1] == dest.datum_params[1]
- && this.datum_params[2] == dest.datum_params[2]);
- } else if( this.datum_type == Proj4js.common.PJD_7PARAM ) {
- return (this.datum_params[0] == dest.datum_params[0]
- && this.datum_params[1] == dest.datum_params[1]
- && this.datum_params[2] == dest.datum_params[2]
- && this.datum_params[3] == dest.datum_params[3]
- && this.datum_params[4] == dest.datum_params[4]
- && this.datum_params[5] == dest.datum_params[5]
- && this.datum_params[6] == dest.datum_params[6]);
- } else if ( this.datum_type == Proj4js.common.PJD_GRIDSHIFT ||
- dest.datum_type == Proj4js.common.PJD_GRIDSHIFT ) {
- alert("ERROR: Grid shift transformations are not implemented.");
- return false
- } else {
- return true; // datums are equal
- }
- }, // cs_compare_datums()
-
- /*
- * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates
- * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),
- * according to the current ellipsoid parameters.
- *
- * Latitude : Geodetic latitude in radians (input)
- * Longitude : Geodetic longitude in radians (input)
- * Height : Geodetic height, in meters (input)
- * X : Calculated Geocentric X coordinate, in meters (output)
- * Y : Calculated Geocentric Y coordinate, in meters (output)
- * Z : Calculated Geocentric Z coordinate, in meters (output)
- *
- */
- geodetic_to_geocentric : function(p) {
- var Longitude = p.x;
- var Latitude = p.y;
- var Height = p.z ? p.z : 0; //Z value not always supplied
- var X; // output
- var Y;
- var Z;
-
- var Error_Code=0; // GEOCENT_NO_ERROR;
- var Rn; /* Earth radius at location */
- var Sin_Lat; /* Math.sin(Latitude) */
- var Sin2_Lat; /* Square of Math.sin(Latitude) */
- var Cos_Lat; /* Math.cos(Latitude) */
-
- /*
- ** Don't blow up if Latitude is just a little out of the value
- ** range as it may just be a rounding issue. Also removed longitude
- ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.
- */
- if( Latitude < -Proj4js.common.HALF_PI && Latitude > -1.001 * Proj4js.common.HALF_PI ) {
- Latitude = -Proj4js.common.HALF_PI;
- } else if( Latitude > Proj4js.common.HALF_PI && Latitude < 1.001 * Proj4js.common.HALF_PI ) {
- Latitude = Proj4js.common.HALF_PI;
- } else if ((Latitude < -Proj4js.common.HALF_PI) || (Latitude > Proj4js.common.HALF_PI)) {
- /* Latitude out of range */
- Proj4js.reportError('geocent:lat out of range:'+Latitude);
- return null;
- }
-
- if (Longitude > Proj4js.common.PI) Longitude -= (2*Proj4js.common.PI);
- Sin_Lat = Math.sin(Latitude);
- Cos_Lat = Math.cos(Latitude);
- Sin2_Lat = Sin_Lat * Sin_Lat;
- Rn = this.a / (Math.sqrt(1.0e0 - this.es * Sin2_Lat));
- X = (Rn + Height) * Cos_Lat * Math.cos(Longitude);
- Y = (Rn + Height) * Cos_Lat * Math.sin(Longitude);
- Z = ((Rn * (1 - this.es)) + Height) * Sin_Lat;
-
- p.x = X;
- p.y = Y;
- p.z = Z;
- return Error_Code;
- }, // cs_geodetic_to_geocentric()
-
-
- geocentric_to_geodetic : function (p) {
-/* local defintions and variables */
-/* end-criterium of loop, accuracy of sin(Latitude) */
-var genau = 1.E-12;
-var genau2 = (genau*genau);
-var maxiter = 30;
-
- var P; /* distance between semi-minor axis and location */
- var RR; /* distance between center and location */
- var CT; /* sin of geocentric latitude */
- var ST; /* cos of geocentric latitude */
- var RX;
- var RK;
- var RN; /* Earth radius at location */
- var CPHI0; /* cos of start or old geodetic latitude in iterations */
- var SPHI0; /* sin of start or old geodetic latitude in iterations */
- var CPHI; /* cos of searched geodetic latitude */
- var SPHI; /* sin of searched geodetic latitude */
- var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */
- var At_Pole; /* indicates location is in polar region */
- var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */
-
- var X = p.x;
- var Y = p.y;
- var Z = p.z ? p.z : 0.0; //Z value not always supplied
- var Longitude;
- var Latitude;
- var Height;
-
- At_Pole = false;
- P = Math.sqrt(X*X+Y*Y);
- RR = Math.sqrt(X*X+Y*Y+Z*Z);
-
-/* special cases for latitude and longitude */
- if (P/this.a < genau) {
-
-/* special case, if P=0. (X=0., Y=0.) */
- At_Pole = true;
- Longitude = 0.0;
-
-/* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis
- * of ellipsoid (=center of mass), Latitude becomes PI/2 */
- if (RR/this.a < genau) {
- Latitude = Proj4js.common.HALF_PI;
- Height = -this.b;
- return;
- }
- } else {
-/* ellipsoidal (geodetic) longitude
- * interval: -PI < Longitude <= +PI */
- Longitude=Math.atan2(Y,X);
- }
-
-/* --------------------------------------------------------------
- * Following iterative algorithm was developped by
- * "Institut f�r Erdmessung", University of Hannover, July 1988.
- * Internet: www.ife.uni-hannover.de
- * Iterative computation of CPHI,SPHI and Height.
- * Iteration of CPHI and SPHI to 10**-12 radian resp.
- * 2*10**-7 arcsec.
- * --------------------------------------------------------------
- */
- CT = Z/RR;
- ST = P/RR;
- RX = 1.0/Math.sqrt(1.0-this.es*(2.0-this.es)*ST*ST);
- CPHI0 = ST*(1.0-this.es)*RX;
- SPHI0 = CT*RX;
- iter = 0;
-
-/* loop to find sin(Latitude) resp. Latitude
- * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */
- do
- {
- iter++;
- RN = this.a/Math.sqrt(1.0-this.es*SPHI0*SPHI0);
-
-/* ellipsoidal (geodetic) height */
- Height = P*CPHI0+Z*SPHI0-RN*(1.0-this.es*SPHI0*SPHI0);
-
- RK = this.es*RN/(RN+Height);
- RX = 1.0/Math.sqrt(1.0-RK*(2.0-RK)*ST*ST);
- CPHI = ST*(1.0-RK)*RX;
- SPHI = CT*RX;
- SDPHI = SPHI*CPHI0-CPHI*SPHI0;
- CPHI0 = CPHI;
- SPHI0 = SPHI;
- }
- while (SDPHI*SDPHI > genau2 && iter < maxiter);
-
-/* ellipsoidal (geodetic) latitude */
- Latitude=Math.atan(SPHI/Math.abs(CPHI));
-
- p.x = Longitude;
- p.y = Latitude;
- p.z = Height;
- return p;
- }, // cs_geocentric_to_geodetic()
-
- /** Convert_Geocentric_To_Geodetic
- * The method used here is derived from 'An Improved Algorithm for
- * Geocentric to Geodetic Coordinate Conversion', by Ralph Toms, Feb 1996
- */
- geocentric_to_geodetic_noniter : function (p) {
- var X = p.x;
- var Y = p.y;
- var Z = p.z ? p.z : 0; //Z value not always supplied
- var Longitude;
- var Latitude;
- var Height;
-
- var W; /* distance from Z axis */
- var W2; /* square of distance from Z axis */
- var T0; /* initial estimate of vertical component */
- var T1; /* corrected estimate of vertical component */
- var S0; /* initial estimate of horizontal component */
- var S1; /* corrected estimate of horizontal component */
- var Sin_B0; /* Math.sin(B0), B0 is estimate of Bowring aux variable */
- var Sin3_B0; /* cube of Math.sin(B0) */
- var Cos_B0; /* Math.cos(B0) */
- var Sin_p1; /* Math.sin(phi1), phi1 is estimated latitude */
- var Cos_p1; /* Math.cos(phi1) */
- var Rn; /* Earth radius at location */
- var Sum; /* numerator of Math.cos(phi1) */
- var At_Pole; /* indicates location is in polar region */
-
- X = parseFloat(X); // cast from string to float
- Y = parseFloat(Y);
- Z = parseFloat(Z);
-
- At_Pole = false;
- if (X != 0.0)
- {
- Longitude = Math.atan2(Y,X);
- }
- else
- {
- if (Y > 0)
- {
- Longitude = Proj4js.common.HALF_PI;
- }
- else if (Y < 0)
- {
- Longitude = -Proj4js.common.HALF_PI;
- }
- else
- {
- At_Pole = true;
- Longitude = 0.0;
- if (Z > 0.0)
- { /* north pole */
- Latitude = Proj4js.common.HALF_PI;
- }
- else if (Z < 0.0)
- { /* south pole */
- Latitude = -Proj4js.common.HALF_PI;
- }
- else
- { /* center of earth */
- Latitude = Proj4js.common.HALF_PI;
- Height = -this.b;
- return;
- }
- }
- }
- W2 = X*X + Y*Y;
- W = Math.sqrt(W2);
- T0 = Z * Proj4js.common.AD_C;
- S0 = Math.sqrt(T0 * T0 + W2);
- Sin_B0 = T0 / S0;
- Cos_B0 = W / S0;
- Sin3_B0 = Sin_B0 * Sin_B0 * Sin_B0;
- T1 = Z + this.b * this.ep2 * Sin3_B0;
- Sum = W - this.a * this.es * Cos_B0 * Cos_B0 * Cos_B0;
- S1 = Math.sqrt(T1*T1 + Sum * Sum);
- Sin_p1 = T1 / S1;
- Cos_p1 = Sum / S1;
- Rn = this.a / Math.sqrt(1.0 - this.es * Sin_p1 * Sin_p1);
- if (Cos_p1 >= Proj4js.common.COS_67P5)
- {
- Height = W / Cos_p1 - Rn;
- }
- else if (Cos_p1 <= -Proj4js.common.COS_67P5)
- {
- Height = W / -Cos_p1 - Rn;
- }
- else
- {
- Height = Z / Sin_p1 + Rn * (this.es - 1.0);
- }
- if (At_Pole == false)
- {
- Latitude = Math.atan(Sin_p1 / Cos_p1);
- }
-
- p.x = Longitude;
- p.y = Latitude;
- p.z = Height;
- return p;
- }, // geocentric_to_geodetic_noniter()
-
- /****************************************************************/
- // pj_geocentic_to_wgs84( p )
- // p = point to transform in geocentric coordinates (x,y,z)
- geocentric_to_wgs84 : function ( p ) {
-
- if( this.datum_type == Proj4js.common.PJD_3PARAM )
- {
- // if( x[io] == HUGE_VAL )
- // continue;
- p.x += this.datum_params[0];
- p.y += this.datum_params[1];
- p.z += this.datum_params[2];
-
- }
- else if (this.datum_type == Proj4js.common.PJD_7PARAM)
- {
- var Dx_BF =this.datum_params[0];
- var Dy_BF =this.datum_params[1];
- var Dz_BF =this.datum_params[2];
- var Rx_BF =this.datum_params[3];
- var Ry_BF =this.datum_params[4];
- var Rz_BF =this.datum_params[5];
- var M_BF =this.datum_params[6];
- // if( x[io] == HUGE_VAL )
- // continue;
- var x_out = M_BF*( p.x - Rz_BF*p.y + Ry_BF*p.z) + Dx_BF;
- var y_out = M_BF*( Rz_BF*p.x + p.y - Rx_BF*p.z) + Dy_BF;
- var z_out = M_BF*(-Ry_BF*p.x + Rx_BF*p.y + p.z) + Dz_BF;
- p.x = x_out;
- p.y = y_out;
- p.z = z_out;
- }
- }, // cs_geocentric_to_wgs84
-
- /****************************************************************/
- // pj_geocentic_from_wgs84()
- // coordinate system definition,
- // point to transform in geocentric coordinates (x,y,z)
- geocentric_from_wgs84 : function( p ) {
-
- if( this.datum_type == Proj4js.common.PJD_3PARAM )
- {
- //if( x[io] == HUGE_VAL )
- // continue;
- p.x -= this.datum_params[0];
- p.y -= this.datum_params[1];
- p.z -= this.datum_params[2];
-
- }
- else if (this.datum_type == Proj4js.common.PJD_7PARAM)
- {
- var Dx_BF =this.datum_params[0];
- var Dy_BF =this.datum_params[1];
- var Dz_BF =this.datum_params[2];
- var Rx_BF =this.datum_params[3];
- var Ry_BF =this.datum_params[4];
- var Rz_BF =this.datum_params[5];
- var M_BF =this.datum_params[6];
- var x_tmp = (p.x - Dx_BF) / M_BF;
- var y_tmp = (p.y - Dy_BF) / M_BF;
- var z_tmp = (p.z - Dz_BF) / M_BF;
- //if( x[io] == HUGE_VAL )
- // continue;
-
- p.x = x_tmp + Rz_BF*y_tmp - Ry_BF*z_tmp;
- p.y = -Rz_BF*x_tmp + y_tmp + Rx_BF*z_tmp;
- p.z = Ry_BF*x_tmp - Rx_BF*y_tmp + z_tmp;
- } //cs_geocentric_from_wgs84()
- }
-});
-
-/** point object, nothing fancy, just allows values to be
- passed back and forth by reference rather than by value.
- Other point classes may be used as long as they have
- x and y properties, which will get modified in the transform method.
-*/
-Proj4js.Point = Proj4js.Class({
-
- /**
- * Constructor: Proj4js.Point
- *
- * Parameters:
- * - x {float} or {Array} either the first coordinates component or
- * the full coordinates
- * - y {float} the second component
- * - z {float} the third component, optional.
- */
- initialize : function(x,y,z) {
- if (typeof x == 'object') {
- this.x = x[0];
- this.y = x[1];
- this.z = x[2] || 0.0;
- } else if (typeof x == 'string' && typeof y == 'undefined') {
- var coords = x.split(',');
- this.x = parseFloat(coords[0]);
- this.y = parseFloat(coords[1]);
- this.z = parseFloat(coords[2]) || 0.0;
- } else {
- this.x = x;
- this.y = y;
- this.z = z || 0.0;
- }
- },
-
- /**
- * APIMethod: clone
- * Build a copy of a Proj4js.Point object.
- *
- * Return:
- * {Proj4js}.Point the cloned point.
- */
- clone : function() {
- return new Proj4js.Point(this.x, this.y, this.z);
- },
-
- /**
- * APIMethod: toString
- * Return a readable string version of the point
- *
- * Return:
- * {String} String representation of Proj4js.Point object.
- * (ex. <i>"x=5,y=42"</i>)
- */
- toString : function() {
- return ("x=" + this.x + ",y=" + this.y);
- },
-
- /**
- * APIMethod: toShortString
- * Return a short string version of the point.
- *
- * Return:
- * {String} Shortened String representation of Proj4js.Point object.
- * (ex. <i>"5, 42"</i>)
- */
- toShortString : function() {
- return (this.x + ", " + this.y);
- }
-});
-
-Proj4js.PrimeMeridian = {
- "greenwich": 0.0, //"0dE",
- "lisbon": -9.131906111111, //"9d07'54.862\"W",
- "paris": 2.337229166667, //"2d20'14.025\"E",
- "bogota": -74.080916666667, //"74d04'51.3\"W",
- "madrid": -3.687938888889, //"3d41'16.58\"W",
- "rome": 12.452333333333, //"12d27'8.4\"E",
- "bern": 7.439583333333, //"7d26'22.5\"E",
- "jakarta": 106.807719444444, //"106d48'27.79\"E",
- "ferro": -17.666666666667, //"17d40'W",
- "brussels": 4.367975, //"4d22'4.71\"E",
- "stockholm": 18.058277777778, //"18d3'29.8\"E",
- "athens": 23.7163375, //"23d42'58.815\"E",
- "oslo": 10.722916666667 //"10d43'22.5\"E"
-};
-
-Proj4js.Ellipsoid = {
- "MERIT": {a:6378137.0, rf:298.257, ellipseName:"MERIT 1983"},
- "SGS85": {a:6378136.0, rf:298.257, ellipseName:"Soviet Geodetic System 85"},
- "GRS80": {a:6378137.0, rf:298.257222101, ellipseName:"GRS 1980(IUGG, 1980)"},
- "IAU76": {a:6378140.0, rf:298.257, ellipseName:"IAU 1976"},
- "airy": {a:6377563.396, b:6356256.910, ellipseName:"Airy 1830"},
- "APL4.": {a:6378137, rf:298.25, ellipseName:"Appl. Physics. 1965"},
- "NWL9D": {a:6378145.0, rf:298.25, ellipseName:"Naval Weapons Lab., 1965"},
- "mod_airy": {a:6377340.189, b:6356034.446, ellipseName:"Modified Airy"},
- "andrae": {a:6377104.43, rf:300.0, ellipseName:"Andrae 1876 (Den., Iclnd.)"},
- "aust_SA": {a:6378160.0, rf:298.25, ellipseName:"Australian Natl & S. Amer. 1969"},
- "GRS67": {a:6378160.0, rf:298.2471674270, ellipseName:"GRS 67(IUGG 1967)"},
- "bessel": {a:6377397.155, rf:299.1528128, ellipseName:"Bessel 1841"},
- "bess_nam": {a:6377483.865, rf:299.1528128, ellipseName:"Bessel 1841 (Namibia)"},
- "clrk66": {a:6378206.4, b:6356583.8, ellipseName:"Clarke 1866"},
- "clrk80": {a:6378249.145, rf:293.4663, ellipseName:"Clarke 1880 mod."},
- "CPM": {a:6375738.7, rf:334.29, ellipseName:"Comm. des Poids et Mesures 1799"},
- "delmbr": {a:6376428.0, rf:311.5, ellipseName:"Delambre 1810 (Belgium)"},
- "engelis": {a:6378136.05, rf:298.2566, ellipseName:"Engelis 1985"},
- "evrst30": {a:6377276.345, rf:300.8017, ellipseName:"Everest 1830"},
- "evrst48": {a:6377304.063, rf:300.8017, ellipseName:"Everest 1948"},
- "evrst56": {a:6377301.243, rf:300.8017, ellipseName:"Everest 1956"},
- "evrst69": {a:6377295.664, rf:300.8017, ellipseName:"Everest 1969"},
- "evrstSS": {a:6377298.556, rf:300.8017, ellipseName:"Everest (Sabah & Sarawak)"},
- "fschr60": {a:6378166.0, rf:298.3, ellipseName:"Fischer (Mercury Datum) 1960"},
- "fschr60m": {a:6378155.0, rf:298.3, ellipseName:"Fischer 1960"},
- "fschr68": {a:6378150.0, rf:298.3, ellipseName:"Fischer 1968"},
- "helmert": {a:6378200.0, rf:298.3, ellipseName:"Helmert 1906"},
- "hough": {a:6378270.0, rf:297.0, ellipseName:"Hough"},
- "intl": {a:6378388.0, rf:297.0, ellipseName:"International 1909 (Hayford)"},
- "kaula": {a:6378163.0, rf:298.24, ellipseName:"Kaula 1961"},
- "lerch": {a:6378139.0, rf:298.257, ellipseName:"Lerch 1979"},
- "mprts": {a:6397300.0, rf:191.0, ellipseName:"Maupertius 1738"},
- "new_intl": {a:6378157.5, b:6356772.2, ellipseName:"New International 1967"},
- "plessis": {a:6376523.0, rf:6355863.0, ellipseName:"Plessis 1817 (France)"},
- "krass": {a:6378245.0, rf:298.3, ellipseName:"Krassovsky, 1942"},
- "SEasia": {a:6378155.0, b:6356773.3205, ellipseName:"Southeast Asia"},
- "walbeck": {a:6376896.0, b:6355834.8467, ellipseName:"Walbeck"},
- "WGS60": {a:6378165.0, rf:298.3, ellipseName:"WGS 60"},
- "WGS66": {a:6378145.0, rf:298.25, ellipseName:"WGS 66"},
- "WGS72": {a:6378135.0, rf:298.26, ellipseName:"WGS 72"},
- "WGS84": {a:6378137.0, rf:298.257223563, ellipseName:"WGS 84"},
- "sphere": {a:6370997.0, b:6370997.0, ellipseName:"Normal Sphere (r=6370997)"}
-};
-
-Proj4js.Datum = {
- "WGS84": {towgs84: "0,0,0", ellipse: "WGS84", datumName: "WGS84"},
- "GGRS87": {towgs84: "-199.87,74.79,246.62", ellipse: "GRS80", datumName: "Greek_Geodetic_Reference_System_1987"},
- "NAD83": {towgs84: "0,0,0", ellipse: "GRS80", datumName: "North_American_Datum_1983"},
- "NAD27": {nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat", ellipse: "clrk66", datumName: "North_American_Datum_1927"},
- "potsdam": {towgs84: "606.0,23.0,413.0", ellipse: "bessel", datumName: "Potsdam Rauenberg 1950 DHDN"},
- "carthage": {towgs84: "-263.0,6.0,431.0", ellipse: "clark80", datumName: "Carthage 1934 Tunisia"},
- "hermannskogel": {towgs84: "653.0,-212.0,449.0", ellipse: "bessel", datumName: "Hermannskogel"},
- "ire65": {towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15", ellipse: "mod_airy", datumName: "Ireland 1965"},
- "nzgd49": {towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993", ellipse: "intl", datumName: "New Zealand Geodetic Datum 1949"},
- "OSGB36": {towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894", ellipse: "airy", datumName: "Airy 1830"}
-};
-
-Proj4js.WGS84 = new Proj4js.Proj('WGS84');
-Proj4js.Datum['OSB36'] = Proj4js.Datum['OSGB36']; //as returned from spatialreference.org
-
-//lookup table to go from the projection name in WKT to the Proj4js projection name
-//build this out as required
-Proj4js.wktProjections = {
- "Lambert Tangential Conformal Conic Projection": "lcc",
- "Mercator": "merc",
- "Popular Visualisation Pseudo Mercator": "merc",
- "Mercator_1SP": "merc",
- "Transverse_Mercator": "tmerc",
- "Transverse Mercator": "tmerc",
- "Lambert Azimuthal Equal Area": "laea",
- "Universal Transverse Mercator System": "utm"
-};
-
-
diff --git a/lib/proj4js-1.1.0-1/stere.js b/lib/proj4js-1.1.0-1/stere.js
deleted file mode 100644
index 8575ffcd6..000000000
--- a/lib/proj4js-1.1.0-1/stere.js
+++ /dev/null
@@ -1,247 +0,0 @@
-
-// Initialize the Stereographic projection
-
-Proj4js.Proj.stere = {
- ssfn_: function(phit, sinphi, eccen) {
- sinphi *= eccen;
- return (Math.tan (.5 * (Proj4js.common.HALF_PI + phit)) * Math.pow((1. - sinphi) / (1. + sinphi), .5 * eccen));
- },
- TOL: 1.e-8,
- NITER: 8,
- CONV: 1.e-10,
- S_POLE: 0,
- N_POLE: 1,
- OBLIQ: 2,
- EQUIT: 3,
-
- init: function() {
- this.phits = this.lat_ts ? this.lat_ts : Proj4js.common.HALF_PI;
- var t = Math.abs(this.lat0);
- if ((Math.abs(t) - Proj4js.common.HALF_PI) < Proj4js.common.EPSLN) {
- this.mode = this.lat0 < 0. ? this.S_POLE : this.N_POLE;
- } else {
- this.mode = t > Proj4js.common.EPSLN ? this.OBLIQ : this.EQUIT;
- }
- this.phits = Math.abs(this.phits);
- if (this.es) {
- var X;
-
- switch (this.mode) {
- case this.N_POLE:
- case this.S_POLE:
- if (Math.abs(this.phits - Proj4js.common.HALF_PI) < Proj4js.common.EPSLN) {
- this.akm1 = 2. * this.k0 / Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e));
- } else {
- t = Math.sin(this.phits);
- this.akm1 = Math.cos(this.phits) / Proj4js.common.tsfnz(this.e, this.phits, t);
- t *= this.e;
- this.akm1 /= Math.sqrt(1. - t * t);
- }
- break;
- case this.EQUIT:
- this.akm1 = 2. * this.k0;
- break;
- case this.OBLIQ:
- t = Math.sin(this.lat0);
- X = 2. * Math.atan(this.ssfn_(this.lat0, t, this.e)) - Proj4js.common.HALF_PI;
- t *= this.e;
- this.akm1 = 2. * this.k0 * Math.cos(this.lat0) / Math.sqrt(1. - t * t);
- this.sinX1 = Math.sin(X);
- this.cosX1 = Math.cos(X);
- break;
- }
- } else {
- switch (this.mode) {
- case this.OBLIQ:
- this.sinph0 = Math.sin(this.lat0);
- this.cosph0 = Math.cos(this.lat0);
- case this.EQUIT:
- this.akm1 = 2. * this.k0;
- break;
- case this.S_POLE:
- case this.N_POLE:
- this.akm1 = Math.abs(this.phits - Proj4js.common.HALF_PI) >= Proj4js.common.EPSLN ?
- Math.cos(this.phits) / Math.tan(Proj4js.common.FORTPI - .5 * this.phits) :
- 2. * this.k0 ;
- break;
- }
- }
- },
-
-// Stereographic forward equations--mapping lat,long to x,y
- forward: function(p) {
- var lon = p.x;
- lon = Proj4js.common.adjust_lon(lon - this.long0);
- var lat = p.y;
- var x, y;
-
- if (this.sphere) {
- var sinphi, cosphi, coslam, sinlam;
-
- sinphi = Math.sin(lat);
- cosphi = Math.cos(lat);
- coslam = Math.cos(lon);
- sinlam = Math.sin(lon);
- switch (this.mode) {
- case this.EQUIT:
- y = 1. + cosphi * coslam;
- if (y <= Proj4js.common.EPSLN) {
- Proj4js.reportError("stere:forward:Equit");
- }
- y = this.akm1 / y;
- x = y * cosphi * sinlam;
- y *= sinphi;
- break;
- case this.OBLIQ:
- y = 1. + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
- if (y <= Proj4js.common.EPSLN) {
- Proj4js.reportError("stere:forward:Obliq");
- }
- y = this.akm1 / y;
- x = y * cosphi * sinlam;
- y *= this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
- break;
- case this.N_POLE:
- coslam = -coslam;
- lat = -lat;
- //Note no break here so it conitnues through S_POLE
- case this.S_POLE:
- if (Math.abs(lat - Proj4js.common.HALF_PI) < this.TOL) {
- Proj4js.reportError("stere:forward:S_POLE");
- }
- y = this.akm1 * Math.tan(Proj4js.common.FORTPI + .5 * lat);
- x = sinlam * y;
- y *= coslam;
- break;
- }
- } else {
- coslam = Math.cos(lon);
- sinlam = Math.sin(lon);
- sinphi = Math.sin(lat);
- var sinX, cosX;
- if (this.mode == this.OBLIQ || this.mode == this.EQUIT) {
- var Xt = 2. * Math.atan(this.ssfn_(lat, sinphi, this.e));
- sinX = Math.sin(Xt - Proj4js.common.HALF_PI);
- cosX = Math.cos(Xt);
- }
- switch (this.mode) {
- case this.OBLIQ:
- var A = this.akm1 / (this.cosX1 * (1. + this.sinX1 * sinX + this.cosX1 * cosX * coslam));
- y = A * (this.cosX1 * sinX - this.sinX1 * cosX * coslam);
- x = A * cosX;
- break;
- case this.EQUIT:
- var A = 2. * this.akm1 / (1. + cosX * coslam);
- y = A * sinX;
- x = A * cosX;
- break;
- case this.S_POLE:
- lat = -lat;
- coslam = - coslam;
- sinphi = -sinphi;
- case this.N_POLE:
- x = this.akm1 * Proj4js.common.tsfnz(this.e, lat, sinphi);
- y = - x * coslam;
- break;
- }
- x = x * sinlam;
- }
- p.x = x*this.a + this.x0;
- p.y = y*this.a + this.y0;
- return p;
- },
-
-
-//* Stereographic inverse equations--mapping x,y to lat/long
- inverse: function(p) {
- var x = (p.x - this.x0)/this.a; /* descale and de-offset */
- var y = (p.y - this.y0)/this.a;
- var lon, lat;
-
- var cosphi, sinphi, tp=0.0, phi_l=0.0, rho, halfe=0.0, pi2=0.0;
- var i;
-
- if (this.sphere) {
- var c, rh, sinc, cosc;
-
- rh = Math.sqrt(x*x + y*y);
- c = 2. * Math.atan(rh / this.akm1);
- sinc = Math.sin(c);
- cosc = Math.cos(c);
- lon = 0.;
- switch (this.mode) {
- case this.EQUIT:
- if (Math.abs(rh) <= Proj4js.common.EPSLN) {
- lat = 0.;
- } else {
- lat = Math.asin(y * sinc / rh);
- }
- if (cosc != 0. || x != 0.) lon = Math.atan2(x * sinc, cosc * rh);
- break;
- case this.OBLIQ:
- if (Math.abs(rh) <= Proj4js.common.EPSLN) {
- lat = this.phi0;
- } else {
- lat = Math.asin(cosc * this.sinph0 + y * sinc * this.cosph0 / rh);
- }
- c = cosc - this.sinph0 * Math.sin(lat);
- if (c != 0. || x != 0.) {
- lon = Math.atan2(x * sinc * this.cosph0, c * rh);
- }
- break;
- case this.N_POLE:
- y = -y;
- case this.S_POLE:
- if (Math.abs(rh) <= Proj4js.common.EPSLN) {
- lat = this.phi0;
- } else {
- lat = Math.asin(this.mode == this.S_POLE ? -cosc : cosc);
- }
- lon = (x == 0. && y == 0.) ? 0. : Math.atan2(x, y);
- break;
- }
- p.x = Proj4js.common.adjust_lon(lon + this.long0);
- p.y = lat;
- } else {
- rho = Math.sqrt(x*x + y*y);
- switch (this.mode) {
- case this.OBLIQ:
- case this.EQUIT:
- tp = 2. * Math.atan2(rho * this.cosX1 , this.akm1);
- cosphi = Math.cos(tp);
- sinphi = Math.sin(tp);
- if( rho == 0.0 ) {
- phi_l = Math.asin(cosphi * this.sinX1);
- } else {
- phi_l = Math.asin(cosphi * this.sinX1 + (y * sinphi * this.cosX1 / rho));
- }
-
- tp = Math.tan(.5 * (Proj4js.common.HALF_PI + phi_l));
- x *= sinphi;
- y = rho * this.cosX1 * cosphi - y * this.sinX1* sinphi;
- pi2 = Proj4js.common.HALF_PI;
- halfe = .5 * this.e;
- break;
- case this.N_POLE:
- y = -y;
- case this.S_POLE:
- tp = - rho / this.akm1;
- phi_l = Proj4js.common.HALF_PI - 2. * Math.atan(tp);
- pi2 = -Proj4js.common.HALF_PI;
- halfe = -.5 * this.e;
- break;
- }
- for (i = this.NITER; i--; phi_l = lat) { //check this
- sinphi = this.e * Math.sin(phi_l);
- lat = 2. * Math.atan(tp * Math.pow((1.+sinphi)/(1.-sinphi), halfe)) - pi2;
- if (Math.abs(phi_l - lat) < this.CONV) {
- if (this.mode == this.S_POLE) lat = -lat;
- lon = (x == 0. && y == 0.) ? 0. : Math.atan2(x, y);
- p.x = Proj4js.common.adjust_lon(lon + this.long0);
- p.y = lat;
- return p;
- }
- }
- }
- }
-};
diff --git a/test/fixtures.js b/test/fixtures.js
index f20162672..704e232fc 100644
--- a/test/fixtures.js
+++ b/test/fixtures.js
@@ -1,3 +1,8 @@
+// FIXME: OL3
+proj4.defs("EPSG:3413", "+title=WGS 84 / NSIDC Sea Ice Polar Stereographic North +proj=stere +lat_0=90 +lat_ts=70 +lon_0=-45 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs");
+proj4.defs("EPSG:3031", "+title=WGS 84 / Antarctic Polar Stereographic +proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs");
+
+
var fixtures = {
red: "ff0000ff",
light_red: "fff0f0ff",
diff --git a/test/proj/wv.proj.change-test.js b/test/proj/wv.proj.change-test.js
index e981367f6..3076bea81 100644
--- a/test/proj/wv.proj.change-test.js
+++ b/test/proj/wv.proj.change-test.js
@@ -29,8 +29,7 @@ buster.testCase("wv.proj.change", {
arctic: {
id: "arctic",
epsg: "3413",
- crs: "EPSG:3413",
- proj4: "Proj4 def"
+ crs: "EPSG:3413"
},
antarctic: {
id: "antarctic",
diff --git a/test/proj/wv.proj.model-test.js b/test/proj/wv.proj.model-test.js
index b4f7c5d5f..e45467018 100644
--- a/test/proj/wv.proj.model-test.js
+++ b/test/proj/wv.proj.model-test.js
@@ -27,13 +27,10 @@ buster.testCase("wv.proj.model", {
"arctic": {
id: "arctic",
epsg: "3413",
- crs: "EPSG:3413",
- proj4: "Proj4 def"
+ crs: "EPSG:3413"
}
}
};
- window.Proj4js = window.Proj4js || {};
- window.Proj4js.defs = window.Proj4js.defs || {};
},
"Initializes with default": function() {
@@ -60,11 +57,13 @@ buster.testCase("wv.proj.model", {
buster.assert.calledOnce(listener);
},
+ /* FIXME: OL3
"Registers projection": function() {
var model = wv.proj.model(this.config);
model.select("arctic");
buster.assert.equals(Proj4js.defs["EPSG:3413"], "Proj4 def");
},
+ */
"Event not fired if selection does not change": function() {
var model = wv.proj.model(this.config);
diff --git a/web/css/wv.map.css b/web/css/wv.map.css
index f8338f3f7..d6b93b6b6 100644
--- a/web/css/wv.map.css
+++ b/web/css/wv.map.css
@@ -80,3 +80,14 @@
border-left: 2px solid #fff;
border-right: 2px solid #fff;
}
+
+.ol-mouse-position {
+ position: absolute;
+ top: auto;
+ right: 10px;
+ bottom: 95px;
+ white-space: pre;
+ color: #fff;
+ text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
+ padding: 5px;
+}
diff --git a/web/ext/proj/proj4js-1.1.0-1/proj4js.js b/web/ext/proj/proj4js-1.1.0-1/proj4js.js
deleted file mode 100644
index 7e57e11b4..000000000
--- a/web/ext/proj/proj4js-1.1.0-1/proj4js.js
+++ /dev/null
@@ -1,2180 +0,0 @@
-/*
-Author: Mike Adair madairATdmsolutions.ca
- Richard Greenwood [email protected]
-License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
-
-$Id: Proj.js 2956 2007-07-09 12:17:52Z steven $
-*/
-
-/**
- * Namespace: Proj4js
- *
- * Proj4js is a JavaScript library to transform point coordinates from one
- * coordinate system to another, including datum transformations.
- *
- * This library is a port of both the Proj.4 and GCTCP C libraries to JavaScript.
- * Enabling these transformations in the browser allows geographic data stored
- * in different projections to be combined in browser-based web mapping
- * applications.
- *
- * Proj4js must have access to coordinate system initialization strings (which
- * are the same as for PROJ.4 command line). Thes can be included in your
- * application using a <script> tag or Proj4js can load CS initialization
- * strings from a local directory or a web service such as spatialreference.org.
- *
- * Similarly, Proj4js must have access to projection transform code. These can
- * be included individually using a <script> tag in your page, built into a
- * custom build of Proj4js or loaded dynamically at run-time. Using the
- * -combined and -compressed versions of Proj4js includes all projection class
- * code by default.
- *
- * Note that dynamic loading of defs and code happens ascynchrously, check the
- * Proj.readyToUse flag before using the Proj object. If the defs and code
- * required by your application are loaded through script tags, dynamic loading
- * is not required and the Proj object will be readyToUse on return from the
- * constructor.
- *
- * All coordinates are handled as points which have a .x and a .y property
- * which will be modified in place.
- *
- * Override Proj4js.reportError for output of alerts and warnings.
- *
- * See http://trac.osgeo.org/proj4js/wiki/UserGuide for full details.
-*/
-
-/**
- * Global namespace object for Proj4js library
- */
-var Proj4js = {
-
- /**
- * Property: defaultDatum
- * The datum to use when no others a specified
- */
- defaultDatum: 'WGS84', //default datum
-
- /**
- * Method: transform(source, dest, point)
- * Transform a point coordinate from one map projection to another. This is
- * really the only public method you should need to use.
- *
- * Parameters:
- * source - {Proj4js.Proj} source map projection for the transformation
- * dest - {Proj4js.Proj} destination map projection for the transformation
- * point - {Object} point to transform, may be geodetic (long, lat) or
- * projected Cartesian (x,y), but should always have x,y properties.
- */
- transform: function(source, dest, point) {
- if (!source.readyToUse) {
- this.reportError("Proj4js initialization for:"+source.srsCode+" not yet complete");
- return point;
- }
- if (!dest.readyToUse) {
- this.reportError("Proj4js initialization for:"+dest.srsCode+" not yet complete");
- return point;
- }
-
- // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84
- if (source.datum && dest.datum && (
- ((source.datum.datum_type == Proj4js.common.PJD_3PARAM || source.datum.datum_type == Proj4js.common.PJD_7PARAM) && dest.datumCode != "WGS84") ||
- ((dest.datum.datum_type == Proj4js.common.PJD_3PARAM || dest.datum.datum_type == Proj4js.common.PJD_7PARAM) && source.datumCode != "WGS84"))) {
- var wgs84 = Proj4js.WGS84;
- this.transform(source, wgs84, point);
- source = wgs84;
- }
-
- // DGR, 2010/11/12
- if (source.axis!="enu") {
- this.adjust_axis(source,false,point);
- }
-
- // Transform source points to long/lat, if they aren't already.
- if ( source.projName=="longlat") {
- point.x *= Proj4js.common.D2R; // convert degrees to radians
- point.y *= Proj4js.common.D2R;
- } else {
- if (source.to_meter) {
- point.x *= source.to_meter;
- point.y *= source.to_meter;
- }
- source.inverse(point); // Convert Cartesian to longlat
- }
-
- // Adjust for the prime meridian if necessary
- if (source.from_greenwich) {
- point.x += source.from_greenwich;
- }
-
- // Convert datums if needed, and if possible.
- point = this.datum_transform( source.datum, dest.datum, point );
-
- // Adjust for the prime meridian if necessary
- if (dest.from_greenwich) {
- point.x -= dest.from_greenwich;
- }
-
- if( dest.projName=="longlat" ) {
- // convert radians to decimal degrees
- point.x *= Proj4js.common.R2D;
- point.y *= Proj4js.common.R2D;
- } else { // else project
- dest.forward(point);
- if (dest.to_meter) {
- point.x /= dest.to_meter;
- point.y /= dest.to_meter;
- }
- }
-
- // DGR, 2010/11/12
- if (dest.axis!="enu") {
- this.adjust_axis(dest,true,point);
- }
-
- return point;
- }, // transform()
-
- /** datum_transform()
- source coordinate system definition,
- destination coordinate system definition,
- point to transform in geodetic coordinates (long, lat, height)
- */
- datum_transform : function( source, dest, point ) {
-
- // Short cut if the datums are identical.
- if( source.compare_datums( dest ) ) {
- return point; // in this case, zero is sucess,
- // whereas cs_compare_datums returns 1 to indicate TRUE
- // confusing, should fix this
- }
-
- // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest
- if( source.datum_type == Proj4js.common.PJD_NODATUM
- || dest.datum_type == Proj4js.common.PJD_NODATUM) {
- return point;
- }
-
- // Do we need to go through geocentric coordinates?
- if( source.es != dest.es || source.a != dest.a
- || source.datum_type == Proj4js.common.PJD_3PARAM
- || source.datum_type == Proj4js.common.PJD_7PARAM
- || dest.datum_type == Proj4js.common.PJD_3PARAM
- || dest.datum_type == Proj4js.common.PJD_7PARAM)
- {
-
- // Convert to geocentric coordinates.
- source.geodetic_to_geocentric( point );
- // CHECK_RETURN;
-
- // Convert between datums
- if( source.datum_type == Proj4js.common.PJD_3PARAM || source.datum_type == Proj4js.common.PJD_7PARAM ) {
- source.geocentric_to_wgs84(point);
- // CHECK_RETURN;
- }
-
- if( dest.datum_type == Proj4js.common.PJD_3PARAM || dest.datum_type == Proj4js.common.PJD_7PARAM ) {
- dest.geocentric_from_wgs84(point);
- // CHECK_RETURN;
- }
-
- // Convert back to geodetic coordinates
- dest.geocentric_to_geodetic( point );
- // CHECK_RETURN;
- }
-
- return point;
- }, // cs_datum_transform
-
- /**
- * Function: adjust_axis
- * Normalize or de-normalized the x/y/z axes. The normal form is "enu"
- * (easting, northing, up).
- * Parameters:
- * crs {Proj4js.Proj} the coordinate reference system
- * denorm {Boolean} when false, normalize
- * point {Object} the coordinates to adjust
- */
- adjust_axis: function(crs, denorm, point) {
- var xin= point.x, yin= point.y, zin= point.z || 0.0;
- var v, t;
- for (var i= 0; i<3; i++) {
- if (denorm && i==2 && point.z===undefined) { continue; }
- if (i==0) { v= xin; t= 'x'; }
- else if (i==1) { v= yin; t= 'y'; }
- else { v= zin; t= 'z'; }
- switch(crs.axis[i]) {
- case 'e':
- point[t]= v;
- break;
- case 'w':
- point[t]= -v;
- break;
- case 'n':
- point[t]= v;
- break;
- case 's':
- point[t]= -v;
- break;
- case 'u':
- if (point[t]!==undefined) { point.z= v; }
- break;
- case 'd':
- if (point[t]!==undefined) { point.z= -v; }
- break;
- default :
- alert("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName);
- return null;
- }
- }
- return point;
- },
-
- /**
- * Function: reportError
- * An internal method to report errors back to user.
- * Override this in applications to report error messages or throw exceptions.
- */
- reportError: function(msg) {
- //console.log(msg);
- },
-
-/**
- *
- * Title: Private Methods
- * The following properties and methods are intended for internal use only.
- *
- * This is a minimal implementation of JavaScript inheritance methods so that
- * Proj4js can be used as a stand-alone library.
- * These are copies of the equivalent OpenLayers methods at v2.7
- */
-
-/**
- * Function: extend
- * Copy all properties of a source object to a destination object. Modifies
- * the passed in destination object. Any properties on the source object
- * that are set to undefined will not be (re)set on the destination object.
- *
- * Parameters:
- * destination - {Object} The object that will be modified
- * source - {Object} The object with properties to be set on the destination
- *
- * Returns:
- * {Object} The destination object.
- */
- extend: function(destination, source) {
- destination = destination || {};
- if(source) {
- for(var property in source) {
- var value = source[property];
- if(value !== undefined) {
- destination[property] = value;
- }
- }
- }
- return destination;
- },
-
-/**
- * Constructor: Class
- * Base class used to construct all other classes. Includes support for
- * multiple inheritance.
- *
- */
- Class: function() {
- var Class = function() {
- this.initialize.apply(this, arguments);
- };
-
- var extended = {};
- var parent;
- for(var i=0; i<arguments.length; ++i) {
- if(typeof arguments[i] == "function") {
- // get the prototype of the superclass
- parent = arguments[i].prototype;
- } else {
- // in this case we're extending with the prototype
- parent = arguments[i];
- }
- Proj4js.extend(extended, parent);
- }
- Class.prototype = extended;
-
- return Class;
- },
-
- /**
- * Function: bind
- * Bind a function to an object. Method to easily create closures with
- * 'this' altered.
- *
- * Parameters:
- * func - {Function} Input function.
- * object - {Object} The object to bind to the input function (as this).
- *
- * Returns:
- * {Function} A closure with 'this' set to the passed in object.
- */
- bind: function(func, object) {
- // create a reference to all arguments past the second one
- var args = Array.prototype.slice.apply(arguments, [2]);
- return function() {
- // Push on any additional arguments from the actual function call.
- // These will come after those sent to the bind call.
- var newArgs = args.concat(
- Array.prototype.slice.apply(arguments, [0])
- );
- return func.apply(object, newArgs);
- };
- },
-
-/**
- * The following properties and methods handle dynamic loading of JSON objects.
- */
-
- /**
- * Property: scriptName
- * {String} The filename of this script without any path.
- */
- scriptName: "proj4js.js",
-
- /**
- * Property: defsLookupService
- * AJAX service to retreive projection definition parameters from
- */
- defsLookupService: 'http://spatialreference.org/ref',
-
- /**
- * Property: libPath
- * internal: http server path to library code.
- */
- libPath: null,
-
- /**
- * Function: getScriptLocation
- * Return the path to this script.
- *
- * Returns:
- * Path to this script
- */
- getScriptLocation: function () {
- if (this.libPath) return this.libPath;
- var scriptName = this.scriptName;
- var scriptNameLen = scriptName.length;
-
- var scripts = document.getElementsByTagName('script');
- for (var i = 0; i < scripts.length; i++) {
- var src = scripts[i].getAttribute('src');
- if (src) {
- var index = src.lastIndexOf(scriptName);
- // is it found, at the end of the URL?
- if ((index > -1) && (index + scriptNameLen == src.length)) {
- this.libPath = src.slice(0, -scriptNameLen);
- break;
- }
- }
- }
- return this.libPath||"";
- },
-
- /**
- * Function: loadScript
- * Load a JS file from a URL into a <script> tag in the page.
- *
- * Parameters:
- * url - {String} The URL containing the script to load
- * onload - {Function} A method to be executed when the script loads successfully
- * onfail - {Function} A method to be executed when there is an error loading the script
- * loadCheck - {Function} A boolean method that checks to see if the script
- * has loaded. Typically this just checks for the existance of
- * an object in the file just loaded.
- */
- loadScript: function(url, onload, onfail, loadCheck) {
- var script = document.createElement('script');
- script.defer = false;
- script.type = "text/javascript";
- script.id = url;
- script.src = url;
- script.onload = onload;
- script.onerror = onfail;
- script.loadCheck = loadCheck;
- if (/MSIE/.test(navigator.userAgent)) {
- script.onreadystatechange = this.checkReadyState;
- }
- document.getElementsByTagName('head')[0].appendChild(script);
- },
-
- /**
- * Function: checkReadyState
- * IE workaround since there is no onerror handler. Calls the user defined
- * loadCheck method to determine if the script is loaded.
- *
- */
- checkReadyState: function() {
- if (this.readyState == 'loaded') {
- if (!this.loadCheck()) {
- this.onerror();
- } else {
- this.onload();
- }
- }
- }
-};
-
-/**
- * Class: Proj4js.Proj
- *
- * Proj objects provide transformation methods for point coordinates
- * between geodetic latitude/longitude and a projected coordinate system.
- * once they have been initialized with a projection code.
- *
- * Initialization of Proj objects is with a projection code, usually EPSG codes,
- * which is the key that will be used with the Proj4js.defs array.
- *
- * The code passed in will be stripped of colons and converted to uppercase
- * to locate projection definition files.
- *
- * A projection object has properties for units and title strings.
- */
-Proj4js.Proj = Proj4js.Class({
-
- /**
- * Property: readyToUse
- * Flag to indicate if initialization is complete for this Proj object
- */
- readyToUse: false,
-
- /**
- * Property: title
- * The title to describe the projection
- */
- title: null,
-
- /**
- * Property: projName
- * The projection class for this projection, e.g. lcc (lambert conformal conic,
- * or merc for mercator). These are exactly equivalent to their Proj4
- * counterparts.
- */
- projName: null,
- /**
- * Property: units
- * The units of the projection. Values include 'm' and 'degrees'
- */
- units: null,
- /**
- * Property: datum
- * The datum specified for the projection
- */
- datum: null,
- /**
- * Property: x0
- * The x coordinate origin
- */
- x0: 0,
- /**
- * Property: y0
- * The y coordinate origin
- */
- y0: 0,
- /**
- * Property: localCS
- * Flag to indicate if the projection is a local one in which no transforms
- * are required.
- */
- localCS: false,
-
- /**
- * Property: queue
- * Buffer (FIFO) to hold callbacks waiting to be called when projection loaded.
- */
- queue: null,
-
- /**
- * Constructor: initialize
- * Constructor for Proj4js.Proj objects
- *
- * Parameters:
- * srsCode - a code for map projection definition parameters. These are usually
- * (but not always) EPSG codes.
- */
- initialize: function(srsCode, callback) {
- this.srsCodeInput = srsCode;
-
- //Register callbacks prior to attempting to process definition
- this.queue = [];
- if( callback ){
- this.queue.push( callback );
- }
-
- //check to see if this is a WKT string
- if ((srsCode.indexOf('GEOGCS') >= 0) ||
- (srsCode.indexOf('GEOCCS') >= 0) ||
- (srsCode.indexOf('PROJCS') >= 0) ||
- (srsCode.indexOf('LOCAL_CS') >= 0)) {
- this.parseWKT(srsCode);
- this.deriveConstants();
- this.loadProjCode(this.projName);
- return;
- }
-
- // DGR 2008-08-03 : support urn and url
- if (srsCode.indexOf('urn:') == 0) {
- //urn:ORIGINATOR:def:crs:CODESPACE:VERSION:ID
- var urn = srsCode.split(':');
- if ((urn[1] == 'ogc' || urn[1] =='x-ogc') &&
- (urn[2] =='def') &&
- (urn[3] =='crs')) {
- srsCode = urn[4]+':'+urn[urn.length-1];
- }
- } else if (srsCode.indexOf('http://') == 0) {
- //url#ID
- var url = srsCode.split('#');
- if (url[0].match(/epsg.org/)) {
- // http://www.epsg.org/#
- srsCode = 'EPSG:'+url[1];
- } else if (url[0].match(/RIG.xml/)) {
- //http://librairies.ign.fr/geoportail/resources/RIG.xml#
- //http://interop.ign.fr/registers/ign/RIG.xml#
- srsCode = 'IGNF:'+url[1];
- }
- }
- this.srsCode = srsCode.toUpperCase();
- if (this.srsCode.indexOf("EPSG") == 0) {
- this.srsCode = this.srsCode;
- this.srsAuth = 'epsg';
- this.srsProjNumber = this.srsCode.substring(5);
- // DGR 2007-11-20 : authority IGNF
- } else if (this.srsCode.indexOf("IGNF") == 0) {
- this.srsCode = this.srsCode;
- this.srsAuth = 'IGNF';
- this.srsProjNumber = this.srsCode.substring(5);
- // DGR 2008-06-19 : pseudo-authority CRS for WMS
- } else if (this.srsCode.indexOf("CRS") == 0) {
- this.srsCode = this.srsCode;
- this.srsAuth = 'CRS';
- this.srsProjNumber = this.srsCode.substring(4);
- } else {
- this.srsAuth = '';
- this.srsProjNumber = this.srsCode;
- }
-
- this.loadProjDefinition();
- },
-
-/**
- * Function: loadProjDefinition
- * Loads the coordinate system initialization string if required.
- * Note that dynamic loading happens asynchronously so an application must
- * wait for the readyToUse property is set to true.
- * To prevent dynamic loading, include the defs through a script tag in
- * your application.
- *
- */
- loadProjDefinition: function() {
- //check in memory
- if (Proj4js.defs[this.srsCode]) {
- this.defsLoaded();
- return;
- }
-
- //else check for def on the server
- var url = Proj4js.getScriptLocation() + 'defs/' + this.srsAuth.toUpperCase() + this.srsProjNumber + '.js';
- Proj4js.loadScript(url,
- Proj4js.bind(this.defsLoaded, this),
- Proj4js.bind(this.loadFromService, this),
- Proj4js.bind(this.checkDefsLoaded, this) );
- },
-
-/**
- * Function: loadFromService
- * Creates the REST URL for loading the definition from a web service and
- * loads it.
- *
- */
- loadFromService: function() {
- //else load from web service
- var url = Proj4js.defsLookupService +'/' + this.srsAuth +'/'+ this.srsProjNumber + '/proj4js/';
- Proj4js.loadScript(url,
- Proj4js.bind(this.defsLoaded, this),
- Proj4js.bind(this.defsFailed, this),
- Proj4js.bind(this.checkDefsLoaded, this) );
- },
-
-/**
- * Function: defsLoaded
- * Continues the Proj object initilization once the def file is loaded
- *
- */
- defsLoaded: function() {
- this.parseDefs();
- this.loadProjCode(this.projName);
- },
-
-/**
- * Function: checkDefsLoaded
- * This is the loadCheck method to see if the def object exists
- *
- */
- checkDefsLoaded: function() {
- if (Proj4js.defs[this.srsCode]) {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Function: defsFailed
- * Report an error in loading the defs file, but continue on using WGS84
- *
- */
- defsFailed: function() {
- Proj4js.reportError('failed to load projection definition for: '+this.srsCode);
- Proj4js.defs[this.srsCode] = Proj4js.defs['WGS84']; //set it to something so it can at least continue
- this.defsLoaded();
- },
-
-/**
- * Function: loadProjCode
- * Loads projection class code dynamically if required.
- * Projection code may be included either through a script tag or in
- * a built version of proj4js
- *
- */
- loadProjCode: function(projName) {
- if (Proj4js.Proj[projName]) {
- this.initTransforms();
- return;
- }
-
- //the URL for the projection code
- var url = Proj4js.getScriptLocation() + 'projCode/' + projName + '.js';
- Proj4js.loadScript(url,
- Proj4js.bind(this.loadProjCodeSuccess, this, projName),
- Proj4js.bind(this.loadProjCodeFailure, this, projName),
- Proj4js.bind(this.checkCodeLoaded, this, projName) );
- },
-
- /**
- * Function: loadProjCodeSuccess
- * Loads any proj dependencies or continue on to final initialization.
- *
- */
- loadProjCodeSuccess: function(projName) {
- if (Proj4js.Proj[projName].dependsOn){
- this.loadProjCode(Proj4js.Proj[projName].dependsOn);
- } else {
- this.initTransforms();
- }
- },
-
- /**
- * Function: defsFailed
- * Report an error in loading the proj file. Initialization of the Proj
- * object has failed and the readyToUse flag will never be set.
- *
- */
- loadProjCodeFailure: function(projName) {
- Proj4js.reportError("failed to find projection file for: " + projName);
- //TBD initialize with identity transforms so proj will still work?
- },
-
-/**
- * Function: checkCodeLoaded
- * This is the loadCheck method to see if the projection code is loaded
- *
- */
- checkCodeLoaded: function(projName) {
- if (Proj4js.Proj[projName]) {
- return true;
- } else {
- return false;
- }
- },
-
-/**
- * Function: initTransforms
- * Finalize the initialization of the Proj object
- *
- */
- initTransforms: function() {
- Proj4js.extend(this, Proj4js.Proj[this.projName]);
- this.init();
- this.readyToUse = true;
- if( this.queue ) {
- var item;
- while( (item = this.queue.shift()) ) {
- item.call( this, this );
- }
- }
- },
-
-/**
- * Function: parseWKT
- * Parses a WKT string to get initialization parameters
- *
- */
- wktRE: /^(\w+)\[(.*)\]$/,
- parseWKT: function(wkt) {
- var wktMatch = wkt.match(this.wktRE);
- if (!wktMatch) return;
- var wktObject = wktMatch[1];
- var wktContent = wktMatch[2];
- var wktTemp = wktContent.split(",");
- var wktName;
- if (wktObject.toUpperCase() == "TOWGS84") {
- wktName = wktObject; //no name supplied for the TOWGS84 array
- } else {
- wktName = wktTemp.shift();
- }
- wktName = wktName.replace(/^\"/,"");
- wktName = wktName.replace(/\"$/,"");
-
- /*
- wktContent = wktTemp.join(",");
- var wktArray = wktContent.split("],");
- for (var i=0; i<wktArray.length-1; ++i) {
- wktArray[i] += "]";
- }
- */
-
- var wktArray = new Array();
- var bkCount = 0;
- var obj = "";
- for (var i=0; i<wktTemp.length; ++i) {
- var token = wktTemp[i];
- for (var j=0; j<token.length; ++j) {
- if (token.charAt(j) == "[") ++bkCount;
- if (token.charAt(j) == "]") --bkCount;
- }
- obj += token;
- if (bkCount === 0) {
- wktArray.push(obj);
- obj = "";
- } else {
- obj += ",";
- }
- }
-
- //do something based on the type of the wktObject being parsed
- //add in variations in the spelling as required
- switch (wktObject) {
- case 'LOCAL_CS':
- this.projName = 'identity'
- this.localCS = true;
- this.srsCode = wktName;
- break;
- case 'GEOGCS':
- this.projName = 'longlat'
- this.geocsCode = wktName;
- if (!this.srsCode) this.srsCode = wktName;
- break;
- case 'PROJCS':
- this.srsCode = wktName;
- break;
- case 'GEOCCS':
- break;
- case 'PROJECTION':
- this.projName = Proj4js.wktProjections[wktName]
- break;
- case 'DATUM':
- this.datumName = wktName;
- break;
- case 'LOCAL_DATUM':
- this.datumCode = 'none';
- break;
- case 'SPHEROID':
- this.ellps = wktName;
- this.a = parseFloat(wktArray.shift());
- this.rf = parseFloat(wktArray.shift());
- break;
- case 'PRIMEM':
- this.from_greenwich = parseFloat(wktArray.shift()); //to radians?
- break;
- case 'UNIT':
- this.units = wktName;
- this.unitsPerMeter = parseFloat(wktArray.shift());
- break;
- case 'PARAMETER':
- var name = wktName.toLowerCase();
- var value = parseFloat(wktArray.shift());
- //there may be many variations on the wktName values, add in case
- //statements as required
- switch (name) {
- case 'false_easting':
- this.x0 = value;
- break;
- case 'false_northing':
- this.y0 = value;
- break;
- case 'scale_factor':
- this.k0 = value;
- break;
- case 'central_meridian':
- this.long0 = value*Proj4js.common.D2R;
- break;
- case 'latitude_of_origin':
- this.lat0 = value*Proj4js.common.D2R;
- break;
- case 'more_here':
- break;
- default:
- break;
- }
- break;
- case 'TOWGS84':
- this.datum_params = wktArray;
- break;
- //DGR 2010-11-12: AXIS
- case 'AXIS':
- var name= wktName.toLowerCase();
- var value= wktArray.shift();
- switch (value) {
- case 'EAST' : value= 'e'; break;
- case 'WEST' : value= 'w'; break;
- case 'NORTH': value= 'n'; break;
- case 'SOUTH': value= 's'; break;
- case 'UP' : value= 'u'; break;
- case 'DOWN' : value= 'd'; break;
- case 'OTHER':
- default : value= ' '; break;//FIXME
- }
- if (!this.axis) { this.axis= "enu"; }
- switch(name) {
- case 'x': this.axis= value + this.axis.substr(1,2); break;
- case 'y': this.axis= this.axis.substr(0,1) + value + this.axis.substr(2,1); break;
- case 'z': this.axis= this.axis.substr(0,2) + value ; break;
- default : break;
- }
- case 'MORE_HERE':
- break;
- default:
- break;
- }
- for (var i=0; i<wktArray.length; ++i) {
- this.parseWKT(wktArray[i]);
- }
- },
-
-/**
- * Function: parseDefs
- * Parses the PROJ.4 initialization string and sets the associated properties.
- *
- */
- parseDefs: function() {
- this.defData = Proj4js.defs[this.srsCode];
- var paramName, paramVal;
- if (!this.defData) {
- return;
- }
- var paramArray=this.defData.split("+");
-
- for (var prop=0; prop<paramArray.length; prop++) {
- var property = paramArray[prop].split("=");
- paramName = property[0].toLowerCase();
- paramVal = property[1];
-
- switch (paramName.replace(/\s/gi,"")) { // trim out spaces
- case "": break; // throw away nameless parameter
- case "title": this.title = paramVal; break;
- case "proj": this.projName = paramVal.replace(/\s/gi,""); break;
- case "units": this.units = paramVal.replace(/\s/gi,""); break;
- case "datum": this.datumCode = paramVal.replace(/\s/gi,""); break;
- case "nadgrids": this.nagrids = paramVal.replace(/\s/gi,""); break;
- case "ellps": this.ellps = paramVal.replace(/\s/gi,""); break;
- case "a": this.a = parseFloat(paramVal); break; // semi-major radius
- case "b": this.b = parseFloat(paramVal); break; // semi-minor radius
- // DGR 2007-11-20
- case "rf": this.rf = parseFloat(paramVal); break; // inverse flattening rf= a/(a-b)
- case "lat_0": this.lat0 = paramVal*Proj4js.common.D2R; break; // phi0, central latitude
- case "lat_1": this.lat1 = paramVal*Proj4js.common.D2R; break; //standard parallel 1
- case "lat_2": this.lat2 = paramVal*Proj4js.common.D2R; break; //standard parallel 2
- case "lat_ts": this.lat_ts = paramVal*Proj4js.common.D2R; break; // used in merc and eqc
- case "lon_0": this.long0 = paramVal*Proj4js.common.D2R; break; // lam0, central longitude
- case "alpha": this.alpha = parseFloat(paramVal)*Proj4js.common.D2R; break; //for somerc projection
- case "lonc": this.longc = paramVal*Proj4js.common.D2R; break; //for somerc projection
- case "x_0": this.x0 = parseFloat(paramVal); break; // false easting
- case "y_0": this.y0 = parseFloat(paramVal); break; // false northing
- case "k_0": this.k0 = parseFloat(paramVal); break; // projection scale factor
- case "k": this.k0 = parseFloat(paramVal); break; // both forms returned
- case "r_a": this.R_A = true; break; // sphere--area of ellipsoid
- case "zone": this.zone = parseInt(paramVal,10); break; // UTM Zone
- case "south": this.utmSouth = true; break; // UTM north/south
- case "towgs84":this.datum_params = paramVal.split(","); break;
- case "to_meter": this.to_meter = parseFloat(paramVal); break; // cartesian scaling
- case "from_greenwich": this.from_greenwich = paramVal*Proj4js.common.D2R; break;
- // DGR 2008-07-09 : if pm is not a well-known prime meridian take
- // the value instead of 0.0, then convert to radians
- case "pm": paramVal = paramVal.replace(/\s/gi,"");
- this.from_greenwich = Proj4js.PrimeMeridian[paramVal] ?
- Proj4js.PrimeMeridian[paramVal] : parseFloat(paramVal);
- this.from_greenwich *= Proj4js.common.D2R;
- break;
- // DGR 2010-11-12: axis
- case "axis": paramVal = paramVal.replace(/\s/gi,"");
- var legalAxis= "ewnsud";
- if (paramVal.length==3 &&
- legalAxis.indexOf(paramVal.substr(0,1))!=-1 &&
- legalAxis.indexOf(paramVal.substr(1,1))!=-1 &&
- legalAxis.indexOf(paramVal.substr(2,1))!=-1) {
- this.axis= paramVal;
- } //FIXME: be silent ?
- break
- case "no_defs": break;
- default: //alert("Unrecognized parameter: " + paramName);
- } // switch()
- } // for paramArray
- this.deriveConstants();
- },
-
-/**
- * Function: deriveConstants
- * Sets several derived constant values and initialization of datum and ellipse
- * parameters.
- *
- */
- deriveConstants: function() {
- if (this.nagrids == '@null') this.datumCode = 'none';
- if (this.datumCode && this.datumCode != 'none') {
- var datumDef = Proj4js.Datum[this.datumCode];
- if (datumDef) {
- this.datum_params = datumDef.towgs84 ? datumDef.towgs84.split(',') : null;
- this.ellps = datumDef.ellipse;
- this.datumName = datumDef.datumName ? datumDef.datumName : this.datumCode;
- }
- }
- if (!this.a) { // do we have an ellipsoid?
- var ellipse = Proj4js.Ellipsoid[this.ellps] ? Proj4js.Ellipsoid[this.ellps] : Proj4js.Ellipsoid['WGS84'];
- Proj4js.extend(this, ellipse);
- }
- if (this.rf && !this.b) this.b = (1.0 - 1.0/this.rf) * this.a;
- if (this.rf === 0 || Math.abs(this.a - this.b)<Proj4js.common.EPSLN) {
- this.sphere = true;
- this.b= this.a;
- }
- this.a2 = this.a * this.a; // used in geocentric
- this.b2 = this.b * this.b; // used in geocentric
- this.es = (this.a2-this.b2)/this.a2; // e ^ 2
- this.e = Math.sqrt(this.es); // eccentricity
- if (this.R_A) {
- this.a *= 1. - this.es * (Proj4js.common.SIXTH + this.es * (Proj4js.common.RA4 + this.es * Proj4js.common.RA6));
- this.a2 = this.a * this.a;
- this.b2 = this.b * this.b;
- this.es = 0.;
- }
- this.ep2=(this.a2-this.b2)/this.b2; // used in geocentric
- if (!this.k0) this.k0 = 1.0; //default value
- //DGR 2010-11-12: axis
- if (!this.axis) { this.axis= "enu"; }
-
- this.datum = new Proj4js.datum(this);
- }
-});
-
-Proj4js.Proj.longlat = {
- init: function() {
- //no-op for longlat
- },
- forward: function(pt) {
- //identity transform
- return pt;
- },
- inverse: function(pt) {
- //identity transform
- return pt;
- }
-};
-Proj4js.Proj.identity = Proj4js.Proj.longlat;
-
-/**
- Proj4js.defs is a collection of coordinate system definition objects in the
- PROJ.4 command line format.
- Generally a def is added by means of a separate .js file for example:
-
- <SCRIPT type="text/javascript" src="defs/EPSG26912.js"></SCRIPT>
-
- def is a CS definition in PROJ.4 WKT format, for example:
- +proj="tmerc" //longlat, etc.
- +a=majorRadius
- +b=minorRadius
- +lat0=somenumber
- +long=somenumber
-*/
-Proj4js.defs = {
- // These are so widely used, we'll go ahead and throw them in
- // without requiring a separate .js file
- 'WGS84': "+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees",
- 'EPSG:4326': "+title=long/lat:WGS84 +proj=longlat +a=6378137.0 +b=6356752.31424518 +ellps=WGS84 +datum=WGS84 +units=degrees",
- 'EPSG:4269': "+title=long/lat:NAD83 +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees",
- 'EPSG:3875': "+title= Google Mercator +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 +no_defs"
-};
-Proj4js.defs['EPSG:3785'] = Proj4js.defs['EPSG:3875']; //maintain backward compat, official code is 3875
-Proj4js.defs['GOOGLE'] = Proj4js.defs['EPSG:3875'];
-Proj4js.defs['EPSG:900913'] = Proj4js.defs['EPSG:3875'];
-Proj4js.defs['EPSG:102113'] = Proj4js.defs['EPSG:3875'];
-
-Proj4js.common = {
- PI : 3.141592653589793238, //Math.PI,
- HALF_PI : 1.570796326794896619, //Math.PI*0.5,
- TWO_PI : 6.283185307179586477, //Math.PI*2,
- FORTPI : 0.78539816339744833,
- R2D : 57.29577951308232088,
- D2R : 0.01745329251994329577,
- SEC_TO_RAD : 4.84813681109535993589914102357e-6, /* SEC_TO_RAD = Pi/180/3600 */
- EPSLN : 1.0e-10,
- MAX_ITER : 20,
- // following constants from geocent.c
- COS_67P5 : 0.38268343236508977, /* cosine of 67.5 degrees */
- AD_C : 1.0026000, /* Toms region 1 constant */
-
- /* datum_type values */
- PJD_UNKNOWN : 0,
- PJD_3PARAM : 1,
- PJD_7PARAM : 2,
- PJD_GRIDSHIFT: 3,
- PJD_WGS84 : 4, // WGS84 or equivalent
- PJD_NODATUM : 5, // WGS84 or equivalent
- SRS_WGS84_SEMIMAJOR : 6378137.0, // only used in grid shift transforms
-
- // ellipoid pj_set_ell.c
- SIXTH : .1666666666666666667, /* 1/6 */
- RA4 : .04722222222222222222, /* 17/360 */
- RA6 : .02215608465608465608, /* 67/3024 */
- RV4 : .06944444444444444444, /* 5/72 */
- RV6 : .04243827160493827160, /* 55/1296 */
-
-// Function to compute the constant small m which is the radius of
-// a parallel of latitude, phi, divided by the semimajor axis.
-// -----------------------------------------------------------------
- msfnz : function(eccent, sinphi, cosphi) {
- var con = eccent * sinphi;
- return cosphi/(Math.sqrt(1.0 - con * con));
- },
-
-// Function to compute the constant small t for use in the forward
-// computations in the Lambert Conformal Conic and the Polar
-// Stereographic projections.
-// -----------------------------------------------------------------
- tsfnz : function(eccent, phi, sinphi) {
- var con = eccent * sinphi;
- var com = .5 * eccent;
- con = Math.pow(((1.0 - con) / (1.0 + con)), com);
- return (Math.tan(.5 * (this.HALF_PI - phi))/con);
- },
-
-// Function to compute the latitude angle, phi2, for the inverse of the
-// Lambert Conformal Conic and Polar Stereographic projections.
-// ----------------------------------------------------------------
- phi2z : function(eccent, ts) {
- var eccnth = .5 * eccent;
- var con, dphi;
- var phi = this.HALF_PI - 2 * Math.atan(ts);
- for (var i = 0; i <= 15; i++) {
- con = eccent * Math.sin(phi);
- dphi = this.HALF_PI - 2 * Math.atan(ts *(Math.pow(((1.0 - con)/(1.0 + con)),eccnth))) - phi;
- phi += dphi;
- if (Math.abs(dphi) <= .0000000001) return phi;
- }
- alert("phi2z has NoConvergence");
- return (-9999);
- },
-
-/* Function to compute constant small q which is the radius of a
- parallel of latitude, phi, divided by the semimajor axis.
-------------------------------------------------------------*/
- qsfnz : function(eccent,sinphi) {
- var con;
- if (eccent > 1.0e-7) {
- con = eccent * sinphi;
- return (( 1.0- eccent * eccent) * (sinphi /(1.0 - con * con) - (.5/eccent)*Math.log((1.0 - con)/(1.0 + con))));
- } else {
- return(2.0 * sinphi);
- }
- },
-
-/* Function to eliminate roundoff errors in asin
-----------------------------------------------*/
- asinz : function(x) {
- if (Math.abs(x)>1.0) {
- x=(x>1.0)?1.0:-1.0;
- }
- return Math.asin(x);
- },
-
-// following functions from gctpc cproj.c for transverse mercator projections
- e0fn : function(x) {return(1.0-0.25*x*(1.0+x/16.0*(3.0+1.25*x)));},
- e1fn : function(x) {return(0.375*x*(1.0+0.25*x*(1.0+0.46875*x)));},
- e2fn : function(x) {return(0.05859375*x*x*(1.0+0.75*x));},
- e3fn : function(x) {return(x*x*x*(35.0/3072.0));},
- mlfn : function(e0,e1,e2,e3,phi) {return(e0*phi-e1*Math.sin(2.0*phi)+e2*Math.sin(4.0*phi)-e3*Math.sin(6.0*phi));},
-
- srat : function(esinp, exp) {
- return(Math.pow((1.0-esinp)/(1.0+esinp), exp));
- },
-
-// Function to return the sign of an argument
- sign : function(x) { if (x < 0.0) return(-1); else return(1);},
-
-// Function to adjust longitude to -180 to 180; input in radians
- adjust_lon : function(x) {
- x = (Math.abs(x) < this.PI) ? x: (x - (this.sign(x)*this.TWO_PI) );
- return x;
- },
-
-// IGNF - DGR : algorithms used by IGN France
-
-// Function to adjust latitude to -90 to 90; input in radians
- adjust_lat : function(x) {
- x= (Math.abs(x) < this.HALF_PI) ? x: (x - (this.sign(x)*this.PI) );
- return x;
- },
-
-// Latitude Isometrique - close to tsfnz ...
- latiso : function(eccent, phi, sinphi) {
- if (Math.abs(phi) > this.HALF_PI) return +Number.NaN;
- if (phi==this.HALF_PI) return Number.POSITIVE_INFINITY;
- if (phi==-1.0*this.HALF_PI) return -1.0*Number.POSITIVE_INFINITY;
-
- var con= eccent*sinphi;
- return Math.log(Math.tan((this.HALF_PI+phi)/2.0))+eccent*Math.log((1.0-con)/(1.0+con))/2.0;
- },
-
- fL : function(x,L) {
- return 2.0*Math.atan(x*Math.exp(L)) - this.HALF_PI;
- },
-
-// Inverse Latitude Isometrique - close to ph2z
- invlatiso : function(eccent, ts) {
- var phi= this.fL(1.0,ts);
- var Iphi= 0.0;
- var con= 0.0;
- do {
- Iphi= phi;
- con= eccent*Math.sin(Iphi);
- phi= this.fL(Math.exp(eccent*Math.log((1.0+con)/(1.0-con))/2.0),ts)
- } while (Math.abs(phi-Iphi)>1.0e-12);
- return phi;
- },
-
-// Needed for Gauss Schreiber
-// Original: Denis Makarov ([email protected])
-// Web Site: http://www.binarythings.com
- sinh : function(x)
- {
- var r= Math.exp(x);
- r= (r-1.0/r)/2.0;
- return r;
- },
-
- cosh : function(x)
- {
- var r= Math.exp(x);
- r= (r+1.0/r)/2.0;
- return r;
- },
-
- tanh : function(x)
- {
- var r= Math.exp(x);
- r= (r-1.0/r)/(r+1.0/r);
- return r;
- },
-
- asinh : function(x)
- {
- var s= (x>= 0? 1.0:-1.0);
- return s*(Math.log( Math.abs(x) + Math.sqrt(x*x+1.0) ));
- },
-
- acosh : function(x)
- {
- return 2.0*Math.log(Math.sqrt((x+1.0)/2.0) + Math.sqrt((x-1.0)/2.0));
- },
-
- atanh : function(x)
- {
- return Math.log((x-1.0)/(x+1.0))/2.0;
- },
-
-// Grande Normale
- gN : function(a,e,sinphi)
- {
- var temp= e*sinphi;
- return a/Math.sqrt(1.0 - temp*temp);
- },
-
- //code from the PROJ.4 pj_mlfn.c file; this may be useful for other projections
- pj_enfn: function(es) {
- var en = new Array();
- en[0] = this.C00 - es * (this.C02 + es * (this.C04 + es * (this.C06 + es * this.C08)));
- en[1] = es * (this.C22 - es * (this.C04 + es * (this.C06 + es * this.C08)));
- var t = es * es;
- en[2] = t * (this.C44 - es * (this.C46 + es * this.C48));
- t *= es;
- en[3] = t * (this.C66 - es * this.C68);
- en[4] = t * es * this.C88;
- return en;
- },
-
- pj_mlfn: function(phi, sphi, cphi, en) {
- cphi *= sphi;
- sphi *= sphi;
- return(en[0] * phi - cphi * (en[1] + sphi*(en[2]+ sphi*(en[3] + sphi*en[4]))));
- },
-
- pj_inv_mlfn: function(arg, es, en) {
- var k = 1./(1.-es);
- var phi = arg;
- for (var i = Proj4js.common.MAX_ITER; i ; --i) { /* rarely goes over 2 iterations */
- var s = Math.sin(phi);
- var t = 1. - es * s * s;
- //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;
- //phi -= t * (t * Math.sqrt(t)) * k;
- t = (this.pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;
- phi -= t;
- if (Math.abs(t) < Proj4js.common.EPSLN)
- return phi;
- }
- Proj4js.reportError("cass:pj_inv_mlfn: Convergence error");
- return phi;
- },
-
-/* meridinal distance for ellipsoid and inverse
-** 8th degree - accurate to < 1e-5 meters when used in conjuction
-** with typical major axis values.
-** Inverse determines phi to EPS (1e-11) radians, about 1e-6 seconds.
-*/
- C00: 1.0,
- C02: .25,
- C04: .046875,
- C06: .01953125,
- C08: .01068115234375,
- C22: .75,
- C44: .46875,
- C46: .01302083333333333333,
- C48: .00712076822916666666,
- C66: .36458333333333333333,
- C68: .00569661458333333333,
- C88: .3076171875
-
-};
-
-/** datum object
-*/
-Proj4js.datum = Proj4js.Class({
-
- initialize : function(proj) {
- this.datum_type = Proj4js.common.PJD_WGS84; //default setting
- if (proj.datumCode && proj.datumCode == 'none') {
- this.datum_type = Proj4js.common.PJD_NODATUM;
- }
- if (proj && proj.datum_params) {
- for (var i=0; i<proj.datum_params.length; i++) {
- proj.datum_params[i]=parseFloat(proj.datum_params[i]);
- }
- if (proj.datum_params[0] != 0 || proj.datum_params[1] != 0 || proj.datum_params[2] != 0 ) {
- this.datum_type = Proj4js.common.PJD_3PARAM;
- }
- if (proj.datum_params.length > 3) {
- if (proj.datum_params[3] != 0 || proj.datum_params[4] != 0 ||
- proj.datum_params[5] != 0 || proj.datum_params[6] != 0 ) {
- this.datum_type = Proj4js.common.PJD_7PARAM;
- proj.datum_params[3] *= Proj4js.common.SEC_TO_RAD;
- proj.datum_params[4] *= Proj4js.common.SEC_TO_RAD;
- proj.datum_params[5] *= Proj4js.common.SEC_TO_RAD;
- proj.datum_params[6] = (proj.datum_params[6]/1000000.0) + 1.0;
- }
- }
- }
- if (proj) {
- this.a = proj.a; //datum object also uses these values
- this.b = proj.b;
- this.es = proj.es;
- this.ep2 = proj.ep2;
- this.datum_params = proj.datum_params;
- }
- },
-
- /****************************************************************/
- // cs_compare_datums()
- // Returns TRUE if the two datums match, otherwise FALSE.
- compare_datums : function( dest ) {
- if( this.datum_type != dest.datum_type ) {
- return false; // false, datums are not equal
- } else if( this.a != dest.a || Math.abs(this.es-dest.es) > 0.000000000050 ) {
- // the tolerence for es is to ensure that GRS80 and WGS84
- // are considered identical
- return false;
- } else if( this.datum_type == Proj4js.common.PJD_3PARAM ) {
- return (this.datum_params[0] == dest.datum_params[0]
- && this.datum_params[1] == dest.datum_params[1]
- && this.datum_params[2] == dest.datum_params[2]);
- } else if( this.datum_type == Proj4js.common.PJD_7PARAM ) {
- return (this.datum_params[0] == dest.datum_params[0]
- && this.datum_params[1] == dest.datum_params[1]
- && this.datum_params[2] == dest.datum_params[2]
- && this.datum_params[3] == dest.datum_params[3]
- && this.datum_params[4] == dest.datum_params[4]
- && this.datum_params[5] == dest.datum_params[5]
- && this.datum_params[6] == dest.datum_params[6]);
- } else if ( this.datum_type == Proj4js.common.PJD_GRIDSHIFT ||
- dest.datum_type == Proj4js.common.PJD_GRIDSHIFT ) {
- alert("ERROR: Grid shift transformations are not implemented.");
- return false
- } else {
- return true; // datums are equal
- }
- }, // cs_compare_datums()
-
- /*
- * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates
- * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),
- * according to the current ellipsoid parameters.
- *
- * Latitude : Geodetic latitude in radians (input)
- * Longitude : Geodetic longitude in radians (input)
- * Height : Geodetic height, in meters (input)
- * X : Calculated Geocentric X coordinate, in meters (output)
- * Y : Calculated Geocentric Y coordinate, in meters (output)
- * Z : Calculated Geocentric Z coordinate, in meters (output)
- *
- */
- geodetic_to_geocentric : function(p) {
- var Longitude = p.x;
- var Latitude = p.y;
- var Height = p.z ? p.z : 0; //Z value not always supplied
- var X; // output
- var Y;
- var Z;
-
- var Error_Code=0; // GEOCENT_NO_ERROR;
- var Rn; /* Earth radius at location */
- var Sin_Lat; /* Math.sin(Latitude) */
- var Sin2_Lat; /* Square of Math.sin(Latitude) */
- var Cos_Lat; /* Math.cos(Latitude) */
-
- /*
- ** Don't blow up if Latitude is just a little out of the value
- ** range as it may just be a rounding issue. Also removed longitude
- ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.
- */
- if( Latitude < -Proj4js.common.HALF_PI && Latitude > -1.001 * Proj4js.common.HALF_PI ) {
- Latitude = -Proj4js.common.HALF_PI;
- } else if( Latitude > Proj4js.common.HALF_PI && Latitude < 1.001 * Proj4js.common.HALF_PI ) {
- Latitude = Proj4js.common.HALF_PI;
- } else if ((Latitude < -Proj4js.common.HALF_PI) || (Latitude > Proj4js.common.HALF_PI)) {
- /* Latitude out of range */
- Proj4js.reportError('geocent:lat out of range:'+Latitude);
- return null;
- }
-
- if (Longitude > Proj4js.common.PI) Longitude -= (2*Proj4js.common.PI);
- Sin_Lat = Math.sin(Latitude);
- Cos_Lat = Math.cos(Latitude);
- Sin2_Lat = Sin_Lat * Sin_Lat;
- Rn = this.a / (Math.sqrt(1.0e0 - this.es * Sin2_Lat));
- X = (Rn + Height) * Cos_Lat * Math.cos(Longitude);
- Y = (Rn + Height) * Cos_Lat * Math.sin(Longitude);
- Z = ((Rn * (1 - this.es)) + Height) * Sin_Lat;
-
- p.x = X;
- p.y = Y;
- p.z = Z;
- return Error_Code;
- }, // cs_geodetic_to_geocentric()
-
-
- geocentric_to_geodetic : function (p) {
-/* local defintions and variables */
-/* end-criterium of loop, accuracy of sin(Latitude) */
-var genau = 1.E-12;
-var genau2 = (genau*genau);
-var maxiter = 30;
-
- var P; /* distance between semi-minor axis and location */
- var RR; /* distance between center and location */
- var CT; /* sin of geocentric latitude */
- var ST; /* cos of geocentric latitude */
- var RX;
- var RK;
- var RN; /* Earth radius at location */
- var CPHI0; /* cos of start or old geodetic latitude in iterations */
- var SPHI0; /* sin of start or old geodetic latitude in iterations */
- var CPHI; /* cos of searched geodetic latitude */
- var SPHI; /* sin of searched geodetic latitude */
- var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */
- var At_Pole; /* indicates location is in polar region */
- var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */
-
- var X = p.x;
- var Y = p.y;
- var Z = p.z ? p.z : 0.0; //Z value not always supplied
- var Longitude;
- var Latitude;
- var Height;
-
- At_Pole = false;
- P = Math.sqrt(X*X+Y*Y);
- RR = Math.sqrt(X*X+Y*Y+Z*Z);
-
-/* special cases for latitude and longitude */
- if (P/this.a < genau) {
-
-/* special case, if P=0. (X=0., Y=0.) */
- At_Pole = true;
- Longitude = 0.0;
-
-/* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis
- * of ellipsoid (=center of mass), Latitude becomes PI/2 */
- if (RR/this.a < genau) {
- Latitude = Proj4js.common.HALF_PI;
- Height = -this.b;
- return;
- }
- } else {
-/* ellipsoidal (geodetic) longitude
- * interval: -PI < Longitude <= +PI */
- Longitude=Math.atan2(Y,X);
- }
-
-/* --------------------------------------------------------------
- * Following iterative algorithm was developped by
- * "Institut f�r Erdmessung", University of Hannover, July 1988.
- * Internet: www.ife.uni-hannover.de
- * Iterative computation of CPHI,SPHI and Height.
- * Iteration of CPHI and SPHI to 10**-12 radian resp.
- * 2*10**-7 arcsec.
- * --------------------------------------------------------------
- */
- CT = Z/RR;
- ST = P/RR;
- RX = 1.0/Math.sqrt(1.0-this.es*(2.0-this.es)*ST*ST);
- CPHI0 = ST*(1.0-this.es)*RX;
- SPHI0 = CT*RX;
- iter = 0;
-
-/* loop to find sin(Latitude) resp. Latitude
- * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */
- do
- {
- iter++;
- RN = this.a/Math.sqrt(1.0-this.es*SPHI0*SPHI0);
-
-/* ellipsoidal (geodetic) height */
- Height = P*CPHI0+Z*SPHI0-RN*(1.0-this.es*SPHI0*SPHI0);
-
- RK = this.es*RN/(RN+Height);
- RX = 1.0/Math.sqrt(1.0-RK*(2.0-RK)*ST*ST);
- CPHI = ST*(1.0-RK)*RX;
- SPHI = CT*RX;
- SDPHI = SPHI*CPHI0-CPHI*SPHI0;
- CPHI0 = CPHI;
- SPHI0 = SPHI;
- }
- while (SDPHI*SDPHI > genau2 && iter < maxiter);
-
-/* ellipsoidal (geodetic) latitude */
- Latitude=Math.atan(SPHI/Math.abs(CPHI));
-
- p.x = Longitude;
- p.y = Latitude;
- p.z = Height;
- return p;
- }, // cs_geocentric_to_geodetic()
-
- /** Convert_Geocentric_To_Geodetic
- * The method used here is derived from 'An Improved Algorithm for
- * Geocentric to Geodetic Coordinate Conversion', by Ralph Toms, Feb 1996
- */
- geocentric_to_geodetic_noniter : function (p) {
- var X = p.x;
- var Y = p.y;
- var Z = p.z ? p.z : 0; //Z value not always supplied
- var Longitude;
- var Latitude;
- var Height;
-
- var W; /* distance from Z axis */
- var W2; /* square of distance from Z axis */
- var T0; /* initial estimate of vertical component */
- var T1; /* corrected estimate of vertical component */
- var S0; /* initial estimate of horizontal component */
- var S1; /* corrected estimate of horizontal component */
- var Sin_B0; /* Math.sin(B0), B0 is estimate of Bowring aux variable */
- var Sin3_B0; /* cube of Math.sin(B0) */
- var Cos_B0; /* Math.cos(B0) */
- var Sin_p1; /* Math.sin(phi1), phi1 is estimated latitude */
- var Cos_p1; /* Math.cos(phi1) */
- var Rn; /* Earth radius at location */
- var Sum; /* numerator of Math.cos(phi1) */
- var At_Pole; /* indicates location is in polar region */
-
- X = parseFloat(X); // cast from string to float
- Y = parseFloat(Y);
- Z = parseFloat(Z);
-
- At_Pole = false;
- if (X != 0.0)
- {
- Longitude = Math.atan2(Y,X);
- }
- else
- {
- if (Y > 0)
- {
- Longitude = Proj4js.common.HALF_PI;
- }
- else if (Y < 0)
- {
- Longitude = -Proj4js.common.HALF_PI;
- }
- else
- {
- At_Pole = true;
- Longitude = 0.0;
- if (Z > 0.0)
- { /* north pole */
- Latitude = Proj4js.common.HALF_PI;
- }
- else if (Z < 0.0)
- { /* south pole */
- Latitude = -Proj4js.common.HALF_PI;
- }
- else
- { /* center of earth */
- Latitude = Proj4js.common.HALF_PI;
- Height = -this.b;
- return;
- }
- }
- }
- W2 = X*X + Y*Y;
- W = Math.sqrt(W2);
- T0 = Z * Proj4js.common.AD_C;
- S0 = Math.sqrt(T0 * T0 + W2);
- Sin_B0 = T0 / S0;
- Cos_B0 = W / S0;
- Sin3_B0 = Sin_B0 * Sin_B0 * Sin_B0;
- T1 = Z + this.b * this.ep2 * Sin3_B0;
- Sum = W - this.a * this.es * Cos_B0 * Cos_B0 * Cos_B0;
- S1 = Math.sqrt(T1*T1 + Sum * Sum);
- Sin_p1 = T1 / S1;
- Cos_p1 = Sum / S1;
- Rn = this.a / Math.sqrt(1.0 - this.es * Sin_p1 * Sin_p1);
- if (Cos_p1 >= Proj4js.common.COS_67P5)
- {
- Height = W / Cos_p1 - Rn;
- }
- else if (Cos_p1 <= -Proj4js.common.COS_67P5)
- {
- Height = W / -Cos_p1 - Rn;
- }
- else
- {
- Height = Z / Sin_p1 + Rn * (this.es - 1.0);
- }
- if (At_Pole == false)
- {
- Latitude = Math.atan(Sin_p1 / Cos_p1);
- }
-
- p.x = Longitude;
- p.y = Latitude;
- p.z = Height;
- return p;
- }, // geocentric_to_geodetic_noniter()
-
- /****************************************************************/
- // pj_geocentic_to_wgs84( p )
- // p = point to transform in geocentric coordinates (x,y,z)
- geocentric_to_wgs84 : function ( p ) {
-
- if( this.datum_type == Proj4js.common.PJD_3PARAM )
- {
- // if( x[io] == HUGE_VAL )
- // continue;
- p.x += this.datum_params[0];
- p.y += this.datum_params[1];
- p.z += this.datum_params[2];
-
- }
- else if (this.datum_type == Proj4js.common.PJD_7PARAM)
- {
- var Dx_BF =this.datum_params[0];
- var Dy_BF =this.datum_params[1];
- var Dz_BF =this.datum_params[2];
- var Rx_BF =this.datum_params[3];
- var Ry_BF =this.datum_params[4];
- var Rz_BF =this.datum_params[5];
- var M_BF =this.datum_params[6];
- // if( x[io] == HUGE_VAL )
- // continue;
- var x_out = M_BF*( p.x - Rz_BF*p.y + Ry_BF*p.z) + Dx_BF;
- var y_out = M_BF*( Rz_BF*p.x + p.y - Rx_BF*p.z) + Dy_BF;
- var z_out = M_BF*(-Ry_BF*p.x + Rx_BF*p.y + p.z) + Dz_BF;
- p.x = x_out;
- p.y = y_out;
- p.z = z_out;
- }
- }, // cs_geocentric_to_wgs84
-
- /****************************************************************/
- // pj_geocentic_from_wgs84()
- // coordinate system definition,
- // point to transform in geocentric coordinates (x,y,z)
- geocentric_from_wgs84 : function( p ) {
-
- if( this.datum_type == Proj4js.common.PJD_3PARAM )
- {
- //if( x[io] == HUGE_VAL )
- // continue;
- p.x -= this.datum_params[0];
- p.y -= this.datum_params[1];
- p.z -= this.datum_params[2];
-
- }
- else if (this.datum_type == Proj4js.common.PJD_7PARAM)
- {
- var Dx_BF =this.datum_params[0];
- var Dy_BF =this.datum_params[1];
- var Dz_BF =this.datum_params[2];
- var Rx_BF =this.datum_params[3];
- var Ry_BF =this.datum_params[4];
- var Rz_BF =this.datum_params[5];
- var M_BF =this.datum_params[6];
- var x_tmp = (p.x - Dx_BF) / M_BF;
- var y_tmp = (p.y - Dy_BF) / M_BF;
- var z_tmp = (p.z - Dz_BF) / M_BF;
- //if( x[io] == HUGE_VAL )
- // continue;
-
- p.x = x_tmp + Rz_BF*y_tmp - Ry_BF*z_tmp;
- p.y = -Rz_BF*x_tmp + y_tmp + Rx_BF*z_tmp;
- p.z = Ry_BF*x_tmp - Rx_BF*y_tmp + z_tmp;
- } //cs_geocentric_from_wgs84()
- }
-});
-
-/** point object, nothing fancy, just allows values to be
- passed back and forth by reference rather than by value.
- Other point classes may be used as long as they have
- x and y properties, which will get modified in the transform method.
-*/
-Proj4js.Point = Proj4js.Class({
-
- /**
- * Constructor: Proj4js.Point
- *
- * Parameters:
- * - x {float} or {Array} either the first coordinates component or
- * the full coordinates
- * - y {float} the second component
- * - z {float} the third component, optional.
- */
- initialize : function(x,y,z) {
- if (typeof x == 'object') {
- this.x = x[0];
- this.y = x[1];
- this.z = x[2] || 0.0;
- } else if (typeof x == 'string' && typeof y == 'undefined') {
- var coords = x.split(',');
- this.x = parseFloat(coords[0]);
- this.y = parseFloat(coords[1]);
- this.z = parseFloat(coords[2]) || 0.0;
- } else {
- this.x = x;
- this.y = y;
- this.z = z || 0.0;
- }
- },
-
- /**
- * APIMethod: clone
- * Build a copy of a Proj4js.Point object.
- *
- * Return:
- * {Proj4js}.Point the cloned point.
- */
- clone : function() {
- return new Proj4js.Point(this.x, this.y, this.z);
- },
-
- /**
- * APIMethod: toString
- * Return a readable string version of the point
- *
- * Return:
- * {String} String representation of Proj4js.Point object.
- * (ex. <i>"x=5,y=42"</i>)
- */
- toString : function() {
- return ("x=" + this.x + ",y=" + this.y);
- },
-
- /**
- * APIMethod: toShortString
- * Return a short string version of the point.
- *
- * Return:
- * {String} Shortened String representation of Proj4js.Point object.
- * (ex. <i>"5, 42"</i>)
- */
- toShortString : function() {
- return (this.x + ", " + this.y);
- }
-});
-
-Proj4js.PrimeMeridian = {
- "greenwich": 0.0, //"0dE",
- "lisbon": -9.131906111111, //"9d07'54.862\"W",
- "paris": 2.337229166667, //"2d20'14.025\"E",
- "bogota": -74.080916666667, //"74d04'51.3\"W",
- "madrid": -3.687938888889, //"3d41'16.58\"W",
- "rome": 12.452333333333, //"12d27'8.4\"E",
- "bern": 7.439583333333, //"7d26'22.5\"E",
- "jakarta": 106.807719444444, //"106d48'27.79\"E",
- "ferro": -17.666666666667, //"17d40'W",
- "brussels": 4.367975, //"4d22'4.71\"E",
- "stockholm": 18.058277777778, //"18d3'29.8\"E",
- "athens": 23.7163375, //"23d42'58.815\"E",
- "oslo": 10.722916666667 //"10d43'22.5\"E"
-};
-
-Proj4js.Ellipsoid = {
- "MERIT": {a:6378137.0, rf:298.257, ellipseName:"MERIT 1983"},
- "SGS85": {a:6378136.0, rf:298.257, ellipseName:"Soviet Geodetic System 85"},
- "GRS80": {a:6378137.0, rf:298.257222101, ellipseName:"GRS 1980(IUGG, 1980)"},
- "IAU76": {a:6378140.0, rf:298.257, ellipseName:"IAU 1976"},
- "airy": {a:6377563.396, b:6356256.910, ellipseName:"Airy 1830"},
- "APL4.": {a:6378137, rf:298.25, ellipseName:"Appl. Physics. 1965"},
- "NWL9D": {a:6378145.0, rf:298.25, ellipseName:"Naval Weapons Lab., 1965"},
- "mod_airy": {a:6377340.189, b:6356034.446, ellipseName:"Modified Airy"},
- "andrae": {a:6377104.43, rf:300.0, ellipseName:"Andrae 1876 (Den., Iclnd.)"},
- "aust_SA": {a:6378160.0, rf:298.25, ellipseName:"Australian Natl & S. Amer. 1969"},
- "GRS67": {a:6378160.0, rf:298.2471674270, ellipseName:"GRS 67(IUGG 1967)"},
- "bessel": {a:6377397.155, rf:299.1528128, ellipseName:"Bessel 1841"},
- "bess_nam": {a:6377483.865, rf:299.1528128, ellipseName:"Bessel 1841 (Namibia)"},
- "clrk66": {a:6378206.4, b:6356583.8, ellipseName:"Clarke 1866"},
- "clrk80": {a:6378249.145, rf:293.4663, ellipseName:"Clarke 1880 mod."},
- "CPM": {a:6375738.7, rf:334.29, ellipseName:"Comm. des Poids et Mesures 1799"},
- "delmbr": {a:6376428.0, rf:311.5, ellipseName:"Delambre 1810 (Belgium)"},
- "engelis": {a:6378136.05, rf:298.2566, ellipseName:"Engelis 1985"},
- "evrst30": {a:6377276.345, rf:300.8017, ellipseName:"Everest 1830"},
- "evrst48": {a:6377304.063, rf:300.8017, ellipseName:"Everest 1948"},
- "evrst56": {a:6377301.243, rf:300.8017, ellipseName:"Everest 1956"},
- "evrst69": {a:6377295.664, rf:300.8017, ellipseName:"Everest 1969"},
- "evrstSS": {a:6377298.556, rf:300.8017, ellipseName:"Everest (Sabah & Sarawak)"},
- "fschr60": {a:6378166.0, rf:298.3, ellipseName:"Fischer (Mercury Datum) 1960"},
- "fschr60m": {a:6378155.0, rf:298.3, ellipseName:"Fischer 1960"},
- "fschr68": {a:6378150.0, rf:298.3, ellipseName:"Fischer 1968"},
- "helmert": {a:6378200.0, rf:298.3, ellipseName:"Helmert 1906"},
- "hough": {a:6378270.0, rf:297.0, ellipseName:"Hough"},
- "intl": {a:6378388.0, rf:297.0, ellipseName:"International 1909 (Hayford)"},
- "kaula": {a:6378163.0, rf:298.24, ellipseName:"Kaula 1961"},
- "lerch": {a:6378139.0, rf:298.257, ellipseName:"Lerch 1979"},
- "mprts": {a:6397300.0, rf:191.0, ellipseName:"Maupertius 1738"},
- "new_intl": {a:6378157.5, b:6356772.2, ellipseName:"New International 1967"},
- "plessis": {a:6376523.0, rf:6355863.0, ellipseName:"Plessis 1817 (France)"},
- "krass": {a:6378245.0, rf:298.3, ellipseName:"Krassovsky, 1942"},
- "SEasia": {a:6378155.0, b:6356773.3205, ellipseName:"Southeast Asia"},
- "walbeck": {a:6376896.0, b:6355834.8467, ellipseName:"Walbeck"},
- "WGS60": {a:6378165.0, rf:298.3, ellipseName:"WGS 60"},
- "WGS66": {a:6378145.0, rf:298.25, ellipseName:"WGS 66"},
- "WGS72": {a:6378135.0, rf:298.26, ellipseName:"WGS 72"},
- "WGS84": {a:6378137.0, rf:298.257223563, ellipseName:"WGS 84"},
- "sphere": {a:6370997.0, b:6370997.0, ellipseName:"Normal Sphere (r=6370997)"}
-};
-
-Proj4js.Datum = {
- "WGS84": {towgs84: "0,0,0", ellipse: "WGS84", datumName: "WGS84"},
- "GGRS87": {towgs84: "-199.87,74.79,246.62", ellipse: "GRS80", datumName: "Greek_Geodetic_Reference_System_1987"},
- "NAD83": {towgs84: "0,0,0", ellipse: "GRS80", datumName: "North_American_Datum_1983"},
- "NAD27": {nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat", ellipse: "clrk66", datumName: "North_American_Datum_1927"},
- "potsdam": {towgs84: "606.0,23.0,413.0", ellipse: "bessel", datumName: "Potsdam Rauenberg 1950 DHDN"},
- "carthage": {towgs84: "-263.0,6.0,431.0", ellipse: "clark80", datumName: "Carthage 1934 Tunisia"},
- "hermannskogel": {towgs84: "653.0,-212.0,449.0", ellipse: "bessel", datumName: "Hermannskogel"},
- "ire65": {towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15", ellipse: "mod_airy", datumName: "Ireland 1965"},
- "nzgd49": {towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993", ellipse: "intl", datumName: "New Zealand Geodetic Datum 1949"},
- "OSGB36": {towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894", ellipse: "airy", datumName: "Airy 1830"}
-};
-
-Proj4js.WGS84 = new Proj4js.Proj('WGS84');
-Proj4js.Datum['OSB36'] = Proj4js.Datum['OSGB36']; //as returned from spatialreference.org
-
-//lookup table to go from the projection name in WKT to the Proj4js projection name
-//build this out as required
-Proj4js.wktProjections = {
- "Lambert Tangential Conformal Conic Projection": "lcc",
- "Mercator": "merc",
- "Popular Visualisation Pseudo Mercator": "merc",
- "Mercator_1SP": "merc",
- "Transverse_Mercator": "tmerc",
- "Transverse Mercator": "tmerc",
- "Lambert Azimuthal Equal Area": "laea",
- "Universal Transverse Mercator System": "utm"
-};
-
-
-
-/*******************************************************************************
-NAME MERCATOR
-
-PURPOSE: Transforms input longitude and latitude to Easting and
- Northing for the Mercator projection. The
- longitude and latitude must be in radians. The Easting
- and Northing values will be returned in meters.
-
-PROGRAMMER DATE
----------- ----
-D. Steinwand, EROS Nov, 1991
-T. Mittan Mar, 1993
-
-ALGORITHM REFERENCES
-
-1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
- Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
- State Government Printing Office, Washington D.C., 1987.
-
-2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
- U.S. Geological Survey Professional Paper 1453 , United State Government
- Printing Office, Washington D.C., 1989.
-*******************************************************************************/
-
-//static double r_major = a; /* major axis */
-//static double r_minor = b; /* minor axis */
-//static double lon_center = long0; /* Center longitude (projection center) */
-//static double lat_origin = lat0; /* center latitude */
-//static double e,es; /* eccentricity constants */
-//static double m1; /* small value m */
-//static double false_northing = y0; /* y offset in meters */
-//static double false_easting = x0; /* x offset in meters */
-//scale_fact = k0
-
-Proj4js.Proj.merc = {
- init : function() {
- //?this.temp = this.r_minor / this.r_major;
- //this.temp = this.b / this.a;
- //this.es = 1.0 - Math.sqrt(this.temp);
- //this.e = Math.sqrt( this.es );
- //?this.m1 = Math.cos(this.lat_origin) / (Math.sqrt( 1.0 - this.es * Math.sin(this.lat_origin) * Math.sin(this.lat_origin)));
- //this.m1 = Math.cos(0.0) / (Math.sqrt( 1.0 - this.es * Math.sin(0.0) * Math.sin(0.0)));
- if (this.lat_ts) {
- if (this.sphere) {
- this.k0 = Math.cos(this.lat_ts);
- } else {
- this.k0 = Proj4js.common.msfnz(this.es, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
- }
- }
- },
-
-/* Mercator forward equations--mapping lat,long to x,y
- --------------------------------------------------*/
-
- forward : function(p) {
- //alert("ll2m coords : "+coords);
- var lon = p.x;
- var lat = p.y;
- // convert to radians
- if ( lat*Proj4js.common.R2D > 90.0 &&
- lat*Proj4js.common.R2D < -90.0 &&
- lon*Proj4js.common.R2D > 180.0 &&
- lon*Proj4js.common.R2D < -180.0) {
- Proj4js.reportError("merc:forward: llInputOutOfRange: "+ lon +" : " + lat);
- return null;
- }
-
- var x,y;
- if(Math.abs( Math.abs(lat) - Proj4js.common.HALF_PI) <= Proj4js.common.EPSLN) {
- Proj4js.reportError("merc:forward: ll2mAtPoles");
- return null;
- } else {
- if (this.sphere) {
- x = this.x0 + this.a * this.k0 * Proj4js.common.adjust_lon(lon - this.long0);
- y = this.y0 + this.a * this.k0 * Math.log(Math.tan(Proj4js.common.FORTPI + 0.5*lat));
- } else {
- var sinphi = Math.sin(lat);
- var ts = Proj4js.common.tsfnz(this.e,lat,sinphi);
- x = this.x0 + this.a * this.k0 * Proj4js.common.adjust_lon(lon - this.long0);
- y = this.y0 - this.a * this.k0 * Math.log(ts);
- }
- p.x = x;
- p.y = y;
- return p;
- }
- },
-
-
- /* Mercator inverse equations--mapping x,y to lat/long
- --------------------------------------------------*/
- inverse : function(p) {
-
- var x = p.x - this.x0;
- var y = p.y - this.y0;
- var lon,lat;
-
- if (this.sphere) {
- lat = Proj4js.common.HALF_PI - 2.0 * Math.atan(Math.exp(-y / this.a * this.k0));
- } else {
- var ts = Math.exp(-y / (this.a * this.k0));
- lat = Proj4js.common.phi2z(this.e,ts);
- if(lat == -9999) {
- Proj4js.reportError("merc:inverse: lat = -9999");
- return null;
- }
- }
- lon = Proj4js.common.adjust_lon(this.long0+ x / (this.a * this.k0));
-
- p.x = lon;
- p.y = lat;
- return p;
- }
-};
-
-
-
-
-// Initialize the Stereographic projection
-
-Proj4js.Proj.stere = {
- ssfn_: function(phit, sinphi, eccen) {
- sinphi *= eccen;
- return (Math.tan (.5 * (Proj4js.common.HALF_PI + phit)) * Math.pow((1. - sinphi) / (1. + sinphi), .5 * eccen));
- },
- TOL: 1.e-8,
- NITER: 8,
- CONV: 1.e-10,
- S_POLE: 0,
- N_POLE: 1,
- OBLIQ: 2,
- EQUIT: 3,
-
- init: function() {
- this.phits = this.lat_ts ? this.lat_ts : Proj4js.common.HALF_PI;
- var t = Math.abs(this.lat0);
- if ((Math.abs(t) - Proj4js.common.HALF_PI) < Proj4js.common.EPSLN) {
- this.mode = this.lat0 < 0. ? this.S_POLE : this.N_POLE;
- } else {
- this.mode = t > Proj4js.common.EPSLN ? this.OBLIQ : this.EQUIT;
- }
- this.phits = Math.abs(this.phits);
- if (this.es) {
- var X;
-
- switch (this.mode) {
- case this.N_POLE:
- case this.S_POLE:
- if (Math.abs(this.phits - Proj4js.common.HALF_PI) < Proj4js.common.EPSLN) {
- this.akm1 = 2. * this.k0 / Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e));
- } else {
- t = Math.sin(this.phits);
- this.akm1 = Math.cos(this.phits) / Proj4js.common.tsfnz(this.e, this.phits, t);
- t *= this.e;
- this.akm1 /= Math.sqrt(1. - t * t);
- }
- break;
- case this.EQUIT:
- this.akm1 = 2. * this.k0;
- break;
- case this.OBLIQ:
- t = Math.sin(this.lat0);
- X = 2. * Math.atan(this.ssfn_(this.lat0, t, this.e)) - Proj4js.common.HALF_PI;
- t *= this.e;
- this.akm1 = 2. * this.k0 * Math.cos(this.lat0) / Math.sqrt(1. - t * t);
- this.sinX1 = Math.sin(X);
- this.cosX1 = Math.cos(X);
- break;
- }
- } else {
- switch (this.mode) {
- case this.OBLIQ:
- this.sinph0 = Math.sin(this.lat0);
- this.cosph0 = Math.cos(this.lat0);
- case this.EQUIT:
- this.akm1 = 2. * this.k0;
- break;
- case this.S_POLE:
- case this.N_POLE:
- this.akm1 = Math.abs(this.phits - Proj4js.common.HALF_PI) >= Proj4js.common.EPSLN ?
- Math.cos(this.phits) / Math.tan(Proj4js.common.FORTPI - .5 * this.phits) :
- 2. * this.k0 ;
- break;
- }
- }
- },
-
-// Stereographic forward equations--mapping lat,long to x,y
- forward: function(p) {
- var lon = p.x;
- lon = Proj4js.common.adjust_lon(lon - this.long0);
- var lat = p.y;
- var x, y;
-
- if (this.sphere) {
- var sinphi, cosphi, coslam, sinlam;
-
- sinphi = Math.sin(lat);
- cosphi = Math.cos(lat);
- coslam = Math.cos(lon);
- sinlam = Math.sin(lon);
- switch (this.mode) {
- case this.EQUIT:
- y = 1. + cosphi * coslam;
- if (y <= Proj4js.common.EPSLN) {
- Proj4js.reportError("stere:forward:Equit");
- }
- y = this.akm1 / y;
- x = y * cosphi * sinlam;
- y *= sinphi;
- break;
- case this.OBLIQ:
- y = 1. + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
- if (y <= Proj4js.common.EPSLN) {
- Proj4js.reportError("stere:forward:Obliq");
- }
- y = this.akm1 / y;
- x = y * cosphi * sinlam;
- y *= this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
- break;
- case this.N_POLE:
- coslam = -coslam;
- lat = -lat;
- //Note no break here so it conitnues through S_POLE
- case this.S_POLE:
- if (Math.abs(lat - Proj4js.common.HALF_PI) < this.TOL) {
- Proj4js.reportError("stere:forward:S_POLE");
- }
- y = this.akm1 * Math.tan(Proj4js.common.FORTPI + .5 * lat);
- x = sinlam * y;
- y *= coslam;
- break;
- }
- } else {
- coslam = Math.cos(lon);
- sinlam = Math.sin(lon);
- sinphi = Math.sin(lat);
- var sinX, cosX;
- if (this.mode == this.OBLIQ || this.mode == this.EQUIT) {
- var Xt = 2. * Math.atan(this.ssfn_(lat, sinphi, this.e));
- sinX = Math.sin(Xt - Proj4js.common.HALF_PI);
- cosX = Math.cos(Xt);
- }
- switch (this.mode) {
- case this.OBLIQ:
- var A = this.akm1 / (this.cosX1 * (1. + this.sinX1 * sinX + this.cosX1 * cosX * coslam));
- y = A * (this.cosX1 * sinX - this.sinX1 * cosX * coslam);
- x = A * cosX;
- break;
- case this.EQUIT:
- var A = 2. * this.akm1 / (1. + cosX * coslam);
- y = A * sinX;
- x = A * cosX;
- break;
- case this.S_POLE:
- lat = -lat;
- coslam = - coslam;
- sinphi = -sinphi;
- case this.N_POLE:
- x = this.akm1 * Proj4js.common.tsfnz(this.e, lat, sinphi);
- y = - x * coslam;
- break;
- }
- x = x * sinlam;
- }
- p.x = x*this.a + this.x0;
- p.y = y*this.a + this.y0;
- return p;
- },
-
-
-//* Stereographic inverse equations--mapping x,y to lat/long
- inverse: function(p) {
- var x = (p.x - this.x0)/this.a; /* descale and de-offset */
- var y = (p.y - this.y0)/this.a;
- var lon, lat;
-
- var cosphi, sinphi, tp=0.0, phi_l=0.0, rho, halfe=0.0, pi2=0.0;
- var i;
-
- if (this.sphere) {
- var c, rh, sinc, cosc;
-
- rh = Math.sqrt(x*x + y*y);
- c = 2. * Math.atan(rh / this.akm1);
- sinc = Math.sin(c);
- cosc = Math.cos(c);
- lon = 0.;
- switch (this.mode) {
- case this.EQUIT:
- if (Math.abs(rh) <= Proj4js.common.EPSLN) {
- lat = 0.;
- } else {
- lat = Math.asin(y * sinc / rh);
- }
- if (cosc != 0. || x != 0.) lon = Math.atan2(x * sinc, cosc * rh);
- break;
- case this.OBLIQ:
- if (Math.abs(rh) <= Proj4js.common.EPSLN) {
- lat = this.phi0;
- } else {
- lat = Math.asin(cosc * this.sinph0 + y * sinc * this.cosph0 / rh);
- }
- c = cosc - this.sinph0 * Math.sin(lat);
- if (c != 0. || x != 0.) {
- lon = Math.atan2(x * sinc * this.cosph0, c * rh);
- }
- break;
- case this.N_POLE:
- y = -y;
- case this.S_POLE:
- if (Math.abs(rh) <= Proj4js.common.EPSLN) {
- lat = this.phi0;
- } else {
- lat = Math.asin(this.mode == this.S_POLE ? -cosc : cosc);
- }
- lon = (x == 0. && y == 0.) ? 0. : Math.atan2(x, y);
- break;
- }
- p.x = Proj4js.common.adjust_lon(lon + this.long0);
- p.y = lat;
- } else {
- rho = Math.sqrt(x*x + y*y);
- switch (this.mode) {
- case this.OBLIQ:
- case this.EQUIT:
- tp = 2. * Math.atan2(rho * this.cosX1 , this.akm1);
- cosphi = Math.cos(tp);
- sinphi = Math.sin(tp);
- if( rho == 0.0 ) {
- phi_l = Math.asin(cosphi * this.sinX1);
- } else {
- phi_l = Math.asin(cosphi * this.sinX1 + (y * sinphi * this.cosX1 / rho));
- }
-
- tp = Math.tan(.5 * (Proj4js.common.HALF_PI + phi_l));
- x *= sinphi;
- y = rho * this.cosX1 * cosphi - y * this.sinX1* sinphi;
- pi2 = Proj4js.common.HALF_PI;
- halfe = .5 * this.e;
- break;
- case this.N_POLE:
- y = -y;
- case this.S_POLE:
- tp = - rho / this.akm1;
- phi_l = Proj4js.common.HALF_PI - 2. * Math.atan(tp);
- pi2 = -Proj4js.common.HALF_PI;
- halfe = -.5 * this.e;
- break;
- }
- for (i = this.NITER; i--; phi_l = lat) { //check this
- sinphi = this.e * Math.sin(phi_l);
- lat = 2. * Math.atan(tp * Math.pow((1.+sinphi)/(1.-sinphi), halfe)) - pi2;
- if (Math.abs(phi_l - lat) < this.CONV) {
- if (this.mode == this.S_POLE) lat = -lat;
- lon = (x == 0. && y == 0.) ? 0. : Math.atan2(x, y);
- p.x = Proj4js.common.adjust_lon(lon + this.long0);
- p.y = lat;
- return p;
- }
- }
- }
- }
-};
diff --git a/web/ext/proj/proj4js-1.1.0-1/proj4js.min.js b/web/ext/proj/proj4js-1.1.0-1/proj4js.min.js
deleted file mode 100644
index e86090b8d..000000000
--- a/web/ext/proj/proj4js-1.1.0-1/proj4js.min.js
+++ /dev/null
@@ -1 +0,0 @@
-var Proj4js={defaultDatum:"WGS84",transform:function(a,b,c){if(!a.readyToUse)return this.reportError("Proj4js initialization for:"+a.srsCode+" not yet complete"),c;if(!b.readyToUse)return this.reportError("Proj4js initialization for:"+b.srsCode+" not yet complete"),c;if(a.datum&&b.datum&&((a.datum.datum_type==Proj4js.common.PJD_3PARAM||a.datum.datum_type==Proj4js.common.PJD_7PARAM)&&"WGS84"!=b.datumCode||(b.datum.datum_type==Proj4js.common.PJD_3PARAM||b.datum.datum_type==Proj4js.common.PJD_7PARAM)&&"WGS84"!=a.datumCode)){var d=Proj4js.WGS84;this.transform(a,d,c),a=d}return"enu"!=a.axis&&this.adjust_axis(a,!1,c),"longlat"==a.projName?(c.x*=Proj4js.common.D2R,c.y*=Proj4js.common.D2R):(a.to_meter&&(c.x*=a.to_meter,c.y*=a.to_meter),a.inverse(c)),a.from_greenwich&&(c.x+=a.from_greenwich),c=this.datum_transform(a.datum,b.datum,c),b.from_greenwich&&(c.x-=b.from_greenwich),"longlat"==b.projName?(c.x*=Proj4js.common.R2D,c.y*=Proj4js.common.R2D):(b.forward(c),b.to_meter&&(c.x/=b.to_meter,c.y/=b.to_meter)),"enu"!=b.axis&&this.adjust_axis(b,!0,c),c},datum_transform:function(a,b,c){return a.compare_datums(b)?c:a.datum_type==Proj4js.common.PJD_NODATUM||b.datum_type==Proj4js.common.PJD_NODATUM?c:((a.es!=b.es||a.a!=b.a||a.datum_type==Proj4js.common.PJD_3PARAM||a.datum_type==Proj4js.common.PJD_7PARAM||b.datum_type==Proj4js.common.PJD_3PARAM||b.datum_type==Proj4js.common.PJD_7PARAM)&&(a.geodetic_to_geocentric(c),(a.datum_type==Proj4js.common.PJD_3PARAM||a.datum_type==Proj4js.common.PJD_7PARAM)&&a.geocentric_to_wgs84(c),(b.datum_type==Proj4js.common.PJD_3PARAM||b.datum_type==Proj4js.common.PJD_7PARAM)&&b.geocentric_from_wgs84(c),b.geocentric_to_geodetic(c)),c)},adjust_axis:function(a,b,c){for(var d,e,f=c.x,g=c.y,h=c.z||0,i=0;3>i;i++)if(!b||2!=i||void 0!==c.z)switch(0==i?(d=f,e="x"):1==i?(d=g,e="y"):(d=h,e="z"),a.axis[i]){case"e":c[e]=d;break;case"w":c[e]=-d;break;case"n":c[e]=d;break;case"s":c[e]=-d;break;case"u":void 0!==c[e]&&(c.z=d);break;case"d":void 0!==c[e]&&(c.z=-d);break;default:return alert("ERROR: unknow axis ("+a.axis[i]+") - check definition of "+a.projName),null}return c},reportError:function(){},extend:function(a,b){if(a=a||{},b)for(var c in b){var d=b[c];void 0!==d&&(a[c]=d)}return a},Class:function(){for(var a,b=function(){this.initialize.apply(this,arguments)},c={},d=0;d<arguments.length;++d)a="function"==typeof arguments[d]?arguments[d].prototype:arguments[d],Proj4js.extend(c,a);return b.prototype=c,b},bind:function(a,b){var c=Array.prototype.slice.apply(arguments,[2]);return function(){var d=c.concat(Array.prototype.slice.apply(arguments,[0]));return a.apply(b,d)}},scriptName:"proj4js.js",defsLookupService:"http://spatialreference.org/ref",libPath:null,getScriptLocation:function(){if(this.libPath)return this.libPath;for(var a=this.scriptName,b=a.length,c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var e=c[d].getAttribute("src");if(e){var f=e.lastIndexOf(a);if(f>-1&&f+b==e.length){this.libPath=e.slice(0,-b);break}}}return this.libPath||""},loadScript:function(a,b,c,d){var e=document.createElement("script");e.defer=!1,e.type="text/javascript",e.id=a,e.src=a,e.onload=b,e.onerror=c,e.loadCheck=d,/MSIE/.test(navigator.userAgent)&&(e.onreadystatechange=this.checkReadyState),document.getElementsByTagName("head")[0].appendChild(e)},checkReadyState:function(){"loaded"==this.readyState&&(this.loadCheck()?this.onload():this.onerror())}};Proj4js.Proj=Proj4js.Class({readyToUse:!1,title:null,projName:null,units:null,datum:null,x0:0,y0:0,localCS:!1,queue:null,initialize:function(a,b){if(this.srsCodeInput=a,this.queue=[],b&&this.queue.push(b),a.indexOf("GEOGCS")>=0||a.indexOf("GEOCCS")>=0||a.indexOf("PROJCS")>=0||a.indexOf("LOCAL_CS")>=0)return this.parseWKT(a),this.deriveConstants(),this.loadProjCode(this.projName),void 0;if(0==a.indexOf("urn:")){var c=a.split(":");"ogc"!=c[1]&&"x-ogc"!=c[1]||"def"!=c[2]||"crs"!=c[3]||(a=c[4]+":"+c[c.length-1])}else if(0==a.indexOf("http://")){var d=a.split("#");d[0].match(/epsg.org/)?a="EPSG:"+d[1]:d[0].match(/RIG.xml/)&&(a="IGNF:"+d[1])}this.srsCode=a.toUpperCase(),0==this.srsCode.indexOf("EPSG")?(this.srsCode=this.srsCode,this.srsAuth="epsg",this.srsProjNumber=this.srsCode.substring(5)):0==this.srsCode.indexOf("IGNF")?(this.srsCode=this.srsCode,this.srsAuth="IGNF",this.srsProjNumber=this.srsCode.substring(5)):0==this.srsCode.indexOf("CRS")?(this.srsCode=this.srsCode,this.srsAuth="CRS",this.srsProjNumber=this.srsCode.substring(4)):(this.srsAuth="",this.srsProjNumber=this.srsCode),this.loadProjDefinition()},loadProjDefinition:function(){if(Proj4js.defs[this.srsCode])return this.defsLoaded(),void 0;var a=Proj4js.getScriptLocation()+"defs/"+this.srsAuth.toUpperCase()+this.srsProjNumber+".js";Proj4js.loadScript(a,Proj4js.bind(this.defsLoaded,this),Proj4js.bind(this.loadFromService,this),Proj4js.bind(this.checkDefsLoaded,this))},loadFromService:function(){var a=Proj4js.defsLookupService+"/"+this.srsAuth+"/"+this.srsProjNumber+"/proj4js/";Proj4js.loadScript(a,Proj4js.bind(this.defsLoaded,this),Proj4js.bind(this.defsFailed,this),Proj4js.bind(this.checkDefsLoaded,this))},defsLoaded:function(){this.parseDefs(),this.loadProjCode(this.projName)},checkDefsLoaded:function(){return Proj4js.defs[this.srsCode]?!0:!1},defsFailed:function(){Proj4js.reportError("failed to load projection definition for: "+this.srsCode),Proj4js.defs[this.srsCode]=Proj4js.defs.WGS84,this.defsLoaded()},loadProjCode:function(a){if(Proj4js.Proj[a])return this.initTransforms(),void 0;var b=Proj4js.getScriptLocation()+"projCode/"+a+".js";Proj4js.loadScript(b,Proj4js.bind(this.loadProjCodeSuccess,this,a),Proj4js.bind(this.loadProjCodeFailure,this,a),Proj4js.bind(this.checkCodeLoaded,this,a))},loadProjCodeSuccess:function(a){Proj4js.Proj[a].dependsOn?this.loadProjCode(Proj4js.Proj[a].dependsOn):this.initTransforms()},loadProjCodeFailure:function(a){Proj4js.reportError("failed to find projection file for: "+a)},checkCodeLoaded:function(a){return Proj4js.Proj[a]?!0:!1},initTransforms:function(){if(Proj4js.extend(this,Proj4js.Proj[this.projName]),this.init(),this.readyToUse=!0,this.queue)for(var a;a=this.queue.shift();)a.call(this,this)},wktRE:/^(\w+)\[(.*)\]$/,parseWKT:function(a){var b=a.match(this.wktRE);if(b){var c,d=b[1],e=b[2],f=e.split(",");c="TOWGS84"==d.toUpperCase()?d:f.shift(),c=c.replace(/^\"/,""),c=c.replace(/\"$/,"");for(var g=new Array,h=0,i="",j=0;j<f.length;++j){for(var k=f[j],l=0;l<k.length;++l)"["==k.charAt(l)&&++h,"]"==k.charAt(l)&&--h;i+=k,0===h?(g.push(i),i=""):i+=","}switch(d){case"LOCAL_CS":this.projName="identity",this.localCS=!0,this.srsCode=c;break;case"GEOGCS":this.projName="longlat",this.geocsCode=c,this.srsCode||(this.srsCode=c);break;case"PROJCS":this.srsCode=c;break;case"GEOCCS":break;case"PROJECTION":this.projName=Proj4js.wktProjections[c];break;case"DATUM":this.datumName=c;break;case"LOCAL_DATUM":this.datumCode="none";break;case"SPHEROID":this.ellps=c,this.a=parseFloat(g.shift()),this.rf=parseFloat(g.shift());break;case"PRIMEM":this.from_greenwich=parseFloat(g.shift());break;case"UNIT":this.units=c,this.unitsPerMeter=parseFloat(g.shift());break;case"PARAMETER":var m=c.toLowerCase(),n=parseFloat(g.shift());switch(m){case"false_easting":this.x0=n;break;case"false_northing":this.y0=n;break;case"scale_factor":this.k0=n;break;case"central_meridian":this.long0=n*Proj4js.common.D2R;break;case"latitude_of_origin":this.lat0=n*Proj4js.common.D2R;break;case"more_here":}break;case"TOWGS84":this.datum_params=g;break;case"AXIS":var m=c.toLowerCase(),n=g.shift();switch(n){case"EAST":n="e";break;case"WEST":n="w";break;case"NORTH":n="n";break;case"SOUTH":n="s";break;case"UP":n="u";break;case"DOWN":n="d";break;case"OTHER":default:n=" "}switch(this.axis||(this.axis="enu"),m){case"x":this.axis=n+this.axis.substr(1,2);break;case"y":this.axis=this.axis.substr(0,1)+n+this.axis.substr(2,1);break;case"z":this.axis=this.axis.substr(0,2)+n}case"MORE_HERE":}for(var j=0;j<g.length;++j)this.parseWKT(g[j])}},parseDefs:function(){this.defData=Proj4js.defs[this.srsCode];var a,b;if(this.defData){for(var c=this.defData.split("+"),d=0;d<c.length;d++){var e=c[d].split("=");switch(a=e[0].toLowerCase(),b=e[1],a.replace(/\s/gi,"")){case"":break;case"title":this.title=b;break;case"proj":this.projName=b.replace(/\s/gi,"");break;case"units":this.units=b.replace(/\s/gi,"");break;case"datum":this.datumCode=b.replace(/\s/gi,"");break;case"nadgrids":this.nagrids=b.replace(/\s/gi,"");break;case"ellps":this.ellps=b.replace(/\s/gi,"");break;case"a":this.a=parseFloat(b);break;case"b":this.b=parseFloat(b);break;case"rf":this.rf=parseFloat(b);break;case"lat_0":this.lat0=b*Proj4js.common.D2R;break;case"lat_1":this.lat1=b*Proj4js.common.D2R;break;case"lat_2":this.lat2=b*Proj4js.common.D2R;break;case"lat_ts":this.lat_ts=b*Proj4js.common.D2R;break;case"lon_0":this.long0=b*Proj4js.common.D2R;break;case"alpha":this.alpha=parseFloat(b)*Proj4js.common.D2R;break;case"lonc":this.longc=b*Proj4js.common.D2R;break;case"x_0":this.x0=parseFloat(b);break;case"y_0":this.y0=parseFloat(b);break;case"k_0":this.k0=parseFloat(b);break;case"k":this.k0=parseFloat(b);break;case"r_a":this.R_A=!0;break;case"zone":this.zone=parseInt(b,10);break;case"south":this.utmSouth=!0;break;case"towgs84":this.datum_params=b.split(",");break;case"to_meter":this.to_meter=parseFloat(b);break;case"from_greenwich":this.from_greenwich=b*Proj4js.common.D2R;break;case"pm":b=b.replace(/\s/gi,""),this.from_greenwich=Proj4js.PrimeMeridian[b]?Proj4js.PrimeMeridian[b]:parseFloat(b),this.from_greenwich*=Proj4js.common.D2R;break;case"axis":b=b.replace(/\s/gi,"");var f="ewnsud";3==b.length&&-1!=f.indexOf(b.substr(0,1))&&-1!=f.indexOf(b.substr(1,1))&&-1!=f.indexOf(b.substr(2,1))&&(this.axis=b);break;case"no_defs":}}this.deriveConstants()}},deriveConstants:function(){if("@null"==this.nagrids&&(this.datumCode="none"),this.datumCode&&"none"!=this.datumCode){var a=Proj4js.Datum[this.datumCode];a&&(this.datum_params=a.towgs84?a.towgs84.split(","):null,this.ellps=a.ellipse,this.datumName=a.datumName?a.datumName:this.datumCode)}if(!this.a){var b=Proj4js.Ellipsoid[this.ellps]?Proj4js.Ellipsoid[this.ellps]:Proj4js.Ellipsoid.WGS84;Proj4js.extend(this,b)}this.rf&&!this.b&&(this.b=(1-1/this.rf)*this.a),(0===this.rf||Math.abs(this.a-this.b)<Proj4js.common.EPSLN)&&(this.sphere=!0,this.b=this.a),this.a2=this.a*this.a,this.b2=this.b*this.b,this.es=(this.a2-this.b2)/this.a2,this.e=Math.sqrt(this.es),this.R_A&&(this.a*=1-this.es*(Proj4js.common.SIXTH+this.es*(Proj4js.common.RA4+this.es*Proj4js.common.RA6)),this.a2=this.a*this.a,this.b2=this.b*this.b,this.es=0),this.ep2=(this.a2-this.b2)/this.b2,this.k0||(this.k0=1),this.axis||(this.axis="enu"),this.datum=new Proj4js.datum(this)}}),Proj4js.Proj.longlat={init:function(){},forward:function(a){return a},inverse:function(a){return a}},Proj4js.Proj.identity=Proj4js.Proj.longlat,Proj4js.defs={WGS84:"+title=long/lat:WGS84 +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees","EPSG:4326":"+title=long/lat:WGS84 +proj=longlat +a=6378137.0 +b=6356752.31424518 +ellps=WGS84 +datum=WGS84 +units=degrees","EPSG:4269":"+title=long/lat:NAD83 +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees","EPSG:3875":"+title= Google Mercator +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 +no_defs"},Proj4js.defs["EPSG:3785"]=Proj4js.defs["EPSG:3875"],Proj4js.defs.GOOGLE=Proj4js.defs["EPSG:3875"],Proj4js.defs["EPSG:900913"]=Proj4js.defs["EPSG:3875"],Proj4js.defs["EPSG:102113"]=Proj4js.defs["EPSG:3875"],Proj4js.common={PI:3.141592653589793,HALF_PI:1.5707963267948966,TWO_PI:6.283185307179586,FORTPI:.7853981633974483,R2D:57.29577951308232,D2R:.017453292519943295,SEC_TO_RAD:484813681109536e-20,EPSLN:1e-10,MAX_ITER:20,COS_67P5:.3826834323650898,AD_C:1.0026,PJD_UNKNOWN:0,PJD_3PARAM:1,PJD_7PARAM:2,PJD_GRIDSHIFT:3,PJD_WGS84:4,PJD_NODATUM:5,SRS_WGS84_SEMIMAJOR:6378137,SIXTH:.16666666666666666,RA4:.04722222222222222,RA6:.022156084656084655,RV4:.06944444444444445,RV6:.04243827160493827,msfnz:function(a,b,c){var d=a*b;return c/Math.sqrt(1-d*d)},tsfnz:function(a,b,c){var d=a*c,e=.5*a;return d=Math.pow((1-d)/(1+d),e),Math.tan(.5*(this.HALF_PI-b))/d},phi2z:function(a,b){for(var c,d,e=.5*a,f=this.HALF_PI-2*Math.atan(b),g=0;15>=g;g++)if(c=a*Math.sin(f),d=this.HALF_PI-2*Math.atan(b*Math.pow((1-c)/(1+c),e))-f,f+=d,Math.abs(d)<=1e-10)return f;return alert("phi2z has NoConvergence"),-9999},qsfnz:function(a,b){var c;return a>1e-7?(c=a*b,(1-a*a)*(b/(1-c*c)-.5/a*Math.log((1-c)/(1+c)))):2*b},asinz:function(a){return Math.abs(a)>1&&(a=a>1?1:-1),Math.asin(a)},e0fn:function(a){return 1-.25*a*(1+a/16*(3+1.25*a))},e1fn:function(a){return.375*a*(1+.25*a*(1+.46875*a))},e2fn:function(a){return.05859375*a*a*(1+.75*a)},e3fn:function(a){return a*a*a*(35/3072)},mlfn:function(a,b,c,d,e){return a*e-b*Math.sin(2*e)+c*Math.sin(4*e)-d*Math.sin(6*e)},srat:function(a,b){return Math.pow((1-a)/(1+a),b)},sign:function(a){return 0>a?-1:1},adjust_lon:function(a){return a=Math.abs(a)<this.PI?a:a-this.sign(a)*this.TWO_PI},adjust_lat:function(a){return a=Math.abs(a)<this.HALF_PI?a:a-this.sign(a)*this.PI},latiso:function(a,b,c){if(Math.abs(b)>this.HALF_PI)return+Number.NaN;if(b==this.HALF_PI)return Number.POSITIVE_INFINITY;if(b==-1*this.HALF_PI)return-1*Number.POSITIVE_INFINITY;var d=a*c;return Math.log(Math.tan((this.HALF_PI+b)/2))+a*Math.log((1-d)/(1+d))/2},fL:function(a,b){return 2*Math.atan(a*Math.exp(b))-this.HALF_PI},invlatiso:function(a,b){var c=this.fL(1,b),d=0,e=0;do d=c,e=a*Math.sin(d),c=this.fL(Math.exp(a*Math.log((1+e)/(1-e))/2),b);while(Math.abs(c-d)>1e-12);return c},sinh:function(a){var b=Math.exp(a);return b=(b-1/b)/2},cosh:function(a){var b=Math.exp(a);return b=(b+1/b)/2},tanh:function(a){var b=Math.exp(a);return b=(b-1/b)/(b+1/b)},asinh:function(a){var b=a>=0?1:-1;return b*Math.log(Math.abs(a)+Math.sqrt(a*a+1))},acosh:function(a){return 2*Math.log(Math.sqrt((a+1)/2)+Math.sqrt((a-1)/2))},atanh:function(a){return Math.log((a-1)/(a+1))/2},gN:function(a,b,c){var d=b*c;return a/Math.sqrt(1-d*d)},pj_enfn:function(a){var b=new Array;b[0]=this.C00-a*(this.C02+a*(this.C04+a*(this.C06+a*this.C08))),b[1]=a*(this.C22-a*(this.C04+a*(this.C06+a*this.C08)));var c=a*a;return b[2]=c*(this.C44-a*(this.C46+a*this.C48)),c*=a,b[3]=c*(this.C66-a*this.C68),b[4]=c*a*this.C88,b},pj_mlfn:function(a,b,c,d){return c*=b,b*=b,d[0]*a-c*(d[1]+b*(d[2]+b*(d[3]+b*d[4])))},pj_inv_mlfn:function(a,b,c){for(var d=1/(1-b),e=a,f=Proj4js.common.MAX_ITER;f;--f){var g=Math.sin(e),h=1-b*g*g;if(h=(this.pj_mlfn(e,g,Math.cos(e),c)-a)*h*Math.sqrt(h)*d,e-=h,Math.abs(h)<Proj4js.common.EPSLN)return e}return Proj4js.reportError("cass:pj_inv_mlfn: Convergence error"),e},C00:1,C02:.25,C04:.046875,C06:.01953125,C08:.01068115234375,C22:.75,C44:.46875,C46:.013020833333333334,C48:.007120768229166667,C66:.3645833333333333,C68:.005696614583333333,C88:.3076171875},Proj4js.datum=Proj4js.Class({initialize:function(a){if(this.datum_type=Proj4js.common.PJD_WGS84,a.datumCode&&"none"==a.datumCode&&(this.datum_type=Proj4js.common.PJD_NODATUM),a&&a.datum_params){for(var b=0;b<a.datum_params.length;b++)a.datum_params[b]=parseFloat(a.datum_params[b]);(0!=a.datum_params[0]||0!=a.datum_params[1]||0!=a.datum_params[2])&&(this.datum_type=Proj4js.common.PJD_3PARAM),a.datum_params.length>3&&(0!=a.datum_params[3]||0!=a.datum_params[4]||0!=a.datum_params[5]||0!=a.datum_params[6])&&(this.datum_type=Proj4js.common.PJD_7PARAM,a.datum_params[3]*=Proj4js.common.SEC_TO_RAD,a.datum_params[4]*=Proj4js.common.SEC_TO_RAD,a.datum_params[5]*=Proj4js.common.SEC_TO_RAD,a.datum_params[6]=a.datum_params[6]/1e6+1)}a&&(this.a=a.a,this.b=a.b,this.es=a.es,this.ep2=a.ep2,this.datum_params=a.datum_params)},compare_datums:function(a){return this.datum_type!=a.datum_type?!1:this.a!=a.a||Math.abs(this.es-a.es)>5e-11?!1:this.datum_type==Proj4js.common.PJD_3PARAM?this.datum_params[0]==a.datum_params[0]&&this.datum_params[1]==a.datum_params[1]&&this.datum_params[2]==a.datum_params[2]:this.datum_type==Proj4js.common.PJD_7PARAM?this.datum_params[0]==a.datum_params[0]&&this.datum_params[1]==a.datum_params[1]&&this.datum_params[2]==a.datum_params[2]&&this.datum_params[3]==a.datum_params[3]&&this.datum_params[4]==a.datum_params[4]&&this.datum_params[5]==a.datum_params[5]&&this.datum_params[6]==a.datum_params[6]:this.datum_type==Proj4js.common.PJD_GRIDSHIFT||a.datum_type==Proj4js.common.PJD_GRIDSHIFT?(alert("ERROR: Grid shift transformations are not implemented."),!1):!0},geodetic_to_geocentric:function(a){var b,c,d,e,f,g,h,i=a.x,j=a.y,k=a.z?a.z:0,l=0;if(j<-Proj4js.common.HALF_PI&&j>-1.001*Proj4js.common.HALF_PI)j=-Proj4js.common.HALF_PI;else if(j>Proj4js.common.HALF_PI&&j<1.001*Proj4js.common.HALF_PI)j=Proj4js.common.HALF_PI;else if(j<-Proj4js.common.HALF_PI||j>Proj4js.common.HALF_PI)return Proj4js.reportError("geocent:lat out of range:"+j),null;return i>Proj4js.common.PI&&(i-=2*Proj4js.common.PI),f=Math.sin(j),h=Math.cos(j),g=f*f,e=this.a/Math.sqrt(1-this.es*g),b=(e+k)*h*Math.cos(i),c=(e+k)*h*Math.sin(i),d=(e*(1-this.es)+k)*f,a.x=b,a.y=c,a.z=d,l},geocentric_to_geodetic:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s=1e-12,t=s*s,u=30,v=a.x,w=a.y,x=a.z?a.z:0;if(n=!1,b=Math.sqrt(v*v+w*w),c=Math.sqrt(v*v+w*w+x*x),b/this.a<s){if(n=!0,p=0,c/this.a<s)return q=Proj4js.common.HALF_PI,r=-this.b,void 0}else p=Math.atan2(w,v);d=x/c,e=b/c,f=1/Math.sqrt(1-this.es*(2-this.es)*e*e),i=e*(1-this.es)*f,j=d*f,o=0;do o++,h=this.a/Math.sqrt(1-this.es*j*j),r=b*i+x*j-h*(1-this.es*j*j),g=this.es*h/(h+r),f=1/Math.sqrt(1-g*(2-g)*e*e),k=e*(1-g)*f,l=d*f,m=l*i-k*j,i=k,j=l;while(m*m>t&&u>o);return q=Math.atan(l/Math.abs(k)),a.x=p,a.y=q,a.z=r,a},geocentric_to_geodetic_noniter:function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s=a.x,t=a.y,u=a.z?a.z:0;if(s=parseFloat(s),t=parseFloat(t),u=parseFloat(u),r=!1,0!=s)b=Math.atan2(t,s);else if(t>0)b=Proj4js.common.HALF_PI;else if(0>t)b=-Proj4js.common.HALF_PI;else if(r=!0,b=0,u>0)c=Proj4js.common.HALF_PI;else{if(!(0>u))return c=Proj4js.common.HALF_PI,d=-this.b,void 0;c=-Proj4js.common.HALF_PI}return f=s*s+t*t,e=Math.sqrt(f),g=u*Proj4js.common.AD_C,i=Math.sqrt(g*g+f),k=g/i,m=e/i,l=k*k*k,h=u+this.b*this.ep2*l,q=e-this.a*this.es*m*m*m,j=Math.sqrt(h*h+q*q),n=h/j,o=q/j,p=this.a/Math.sqrt(1-this.es*n*n),d=o>=Proj4js.common.COS_67P5?e/o-p:o<=-Proj4js.common.COS_67P5?e/-o-p:u/n+p*(this.es-1),0==r&&(c=Math.atan(n/o)),a.x=b,a.y=c,a.z=d,a},geocentric_to_wgs84:function(a){if(this.datum_type==Proj4js.common.PJD_3PARAM)a.x+=this.datum_params[0],a.y+=this.datum_params[1],a.z+=this.datum_params[2];else if(this.datum_type==Proj4js.common.PJD_7PARAM){var b=this.datum_params[0],c=this.datum_params[1],d=this.datum_params[2],e=this.datum_params[3],f=this.datum_params[4],g=this.datum_params[5],h=this.datum_params[6],i=h*(a.x-g*a.y+f*a.z)+b,j=h*(g*a.x+a.y-e*a.z)+c,k=h*(-f*a.x+e*a.y+a.z)+d;a.x=i,a.y=j,a.z=k}},geocentric_from_wgs84:function(a){if(this.datum_type==Proj4js.common.PJD_3PARAM)a.x-=this.datum_params[0],a.y-=this.datum_params[1],a.z-=this.datum_params[2];else if(this.datum_type==Proj4js.common.PJD_7PARAM){var b=this.datum_params[0],c=this.datum_params[1],d=this.datum_params[2],e=this.datum_params[3],f=this.datum_params[4],g=this.datum_params[5],h=this.datum_params[6],i=(a.x-b)/h,j=(a.y-c)/h,k=(a.z-d)/h;a.x=i+g*j-f*k,a.y=-g*i+j+e*k,a.z=f*i-e*j+k}}}),Proj4js.Point=Proj4js.Class({initialize:function(a,b,c){if("object"==typeof a)this.x=a[0],this.y=a[1],this.z=a[2]||0;else if("string"==typeof a&&"undefined"==typeof b){var d=a.split(",");this.x=parseFloat(d[0]),this.y=parseFloat(d[1]),this.z=parseFloat(d[2])||0}else this.x=a,this.y=b,this.z=c||0},clone:function(){return new Proj4js.Point(this.x,this.y,this.z)},toString:function(){return"x="+this.x+",y="+this.y},toShortString:function(){return this.x+", "+this.y}}),Proj4js.PrimeMeridian={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},Proj4js.Ellipsoid={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},"APL4.":{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS72:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},Proj4js.Datum={WGS84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},GGRS87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},NAD83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},NAD27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},OSGB36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"}},Proj4js.WGS84=new Proj4js.Proj("WGS84"),Proj4js.Datum.OSB36=Proj4js.Datum.OSGB36,Proj4js.wktProjections={"Lambert Tangential Conformal Conic Projection":"lcc",Mercator:"merc","Popular Visualisation Pseudo Mercator":"merc",Mercator_1SP:"merc",Transverse_Mercator:"tmerc","Transverse Mercator":"tmerc","Lambert Azimuthal Equal Area":"laea","Universal Transverse Mercator System":"utm"},Proj4js.Proj.merc={init:function(){this.lat_ts&&(this.k0=this.sphere?Math.cos(this.lat_ts):Proj4js.common.msfnz(this.es,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(a){var b=a.x,c=a.y;if(c*Proj4js.common.R2D>90&&c*Proj4js.common.R2D<-90&&b*Proj4js.common.R2D>180&&b*Proj4js.common.R2D<-180)return Proj4js.reportError("merc:forward: llInputOutOfRange: "+b+" : "+c),null;var d,e;if(Math.abs(Math.abs(c)-Proj4js.common.HALF_PI)<=Proj4js.common.EPSLN)return Proj4js.reportError("merc:forward: ll2mAtPoles"),null;if(this.sphere)d=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(b-this.long0),e=this.y0+this.a*this.k0*Math.log(Math.tan(Proj4js.common.FORTPI+.5*c));else{var f=Math.sin(c),g=Proj4js.common.tsfnz(this.e,c,f);d=this.x0+this.a*this.k0*Proj4js.common.adjust_lon(b-this.long0),e=this.y0-this.a*this.k0*Math.log(g)}return a.x=d,a.y=e,a},inverse:function(a){var b,c,d=a.x-this.x0,e=a.y-this.y0;if(this.sphere)c=Proj4js.common.HALF_PI-2*Math.atan(Math.exp(-e/this.a*this.k0));else{var f=Math.exp(-e/(this.a*this.k0));if(c=Proj4js.common.phi2z(this.e,f),-9999==c)return Proj4js.reportError("merc:inverse: lat = -9999"),null}return b=Proj4js.common.adjust_lon(this.long0+d/(this.a*this.k0)),a.x=b,a.y=c,a}},Proj4js.Proj.stere={ssfn_:function(a,b,c){return b*=c,Math.tan(.5*(Proj4js.common.HALF_PI+a))*Math.pow((1-b)/(1+b),.5*c)},TOL:1e-8,NITER:8,CONV:1e-10,S_POLE:0,N_POLE:1,OBLIQ:2,EQUIT:3,init:function(){this.phits=this.lat_ts?this.lat_ts:Proj4js.common.HALF_PI;var a=Math.abs(this.lat0);if(this.mode=Math.abs(a)-Proj4js.common.HALF_PI<Proj4js.common.EPSLN?this.lat0<0?this.S_POLE:this.N_POLE:a>Proj4js.common.EPSLN?this.OBLIQ:this.EQUIT,this.phits=Math.abs(this.phits),this.es){var b;switch(this.mode){case this.N_POLE:case this.S_POLE:Math.abs(this.phits-Proj4js.common.HALF_PI)<Proj4js.common.EPSLN?this.akm1=2*this.k0/Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)):(a=Math.sin(this.phits),this.akm1=Math.cos(this.phits)/Proj4js.common.tsfnz(this.e,this.phits,a),a*=this.e,this.akm1/=Math.sqrt(1-a*a));break;case this.EQUIT:this.akm1=2*this.k0;break;case this.OBLIQ:a=Math.sin(this.lat0),b=2*Math.atan(this.ssfn_(this.lat0,a,this.e))-Proj4js.common.HALF_PI,a*=this.e,this.akm1=2*this.k0*Math.cos(this.lat0)/Math.sqrt(1-a*a),this.sinX1=Math.sin(b),this.cosX1=Math.cos(b)}}else switch(this.mode){case this.OBLIQ:this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0);case this.EQUIT:this.akm1=2*this.k0;break;case this.S_POLE:case this.N_POLE:this.akm1=Math.abs(this.phits-Proj4js.common.HALF_PI)>=Proj4js.common.EPSLN?Math.cos(this.phits)/Math.tan(Proj4js.common.FORTPI-.5*this.phits):2*this.k0}},forward:function(a){var b=a.x;b=Proj4js.common.adjust_lon(b-this.long0);var c,d,e=a.y;if(this.sphere){var f,g,h,i;switch(f=Math.sin(e),g=Math.cos(e),h=Math.cos(b),i=Math.sin(b),this.mode){case this.EQUIT:d=1+g*h,d<=Proj4js.common.EPSLN&&Proj4js.reportError("stere:forward:Equit"),d=this.akm1/d,c=d*g*i,d*=f;break;case this.OBLIQ:d=1+this.sinph0*f+this.cosph0*g*h,d<=Proj4js.common.EPSLN&&Proj4js.reportError("stere:forward:Obliq"),d=this.akm1/d,c=d*g*i,d*=this.cosph0*f-this.sinph0*g*h;break;case this.N_POLE:h=-h,e=-e;case this.S_POLE:Math.abs(e-Proj4js.common.HALF_PI)<this.TOL&&Proj4js.reportError("stere:forward:S_POLE"),d=this.akm1*Math.tan(Proj4js.common.FORTPI+.5*e),c=i*d,d*=h}}else{h=Math.cos(b),i=Math.sin(b),f=Math.sin(e);var j,k;if(this.mode==this.OBLIQ||this.mode==this.EQUIT){var l=2*Math.atan(this.ssfn_(e,f,this.e));j=Math.sin(l-Proj4js.common.HALF_PI),k=Math.cos(l)}switch(this.mode){case this.OBLIQ:var m=this.akm1/(this.cosX1*(1+this.sinX1*j+this.cosX1*k*h));d=m*(this.cosX1*j-this.sinX1*k*h),c=m*k;break;case this.EQUIT:var m=2*this.akm1/(1+k*h);d=m*j,c=m*k;break;case this.S_POLE:e=-e,h=-h,f=-f;case this.N_POLE:c=this.akm1*Proj4js.common.tsfnz(this.e,e,f),d=-c*h}c*=i}return a.x=c*this.a+this.x0,a.y=d*this.a+this.y0,a},inverse:function(a){var b,c,d,e,f,g,h=(a.x-this.x0)/this.a,i=(a.y-this.y0)/this.a,j=0,k=0,l=0,m=0;if(this.sphere){var n,o,p,q;switch(o=Math.sqrt(h*h+i*i),n=2*Math.atan(o/this.akm1),p=Math.sin(n),q=Math.cos(n),b=0,this.mode){case this.EQUIT:c=Math.abs(o)<=Proj4js.common.EPSLN?0:Math.asin(i*p/o),(0!=q||0!=h)&&(b=Math.atan2(h*p,q*o));break;case this.OBLIQ:c=Math.abs(o)<=Proj4js.common.EPSLN?this.phi0:Math.asin(q*this.sinph0+i*p*this.cosph0/o),n=q-this.sinph0*Math.sin(c),(0!=n||0!=h)&&(b=Math.atan2(h*p*this.cosph0,n*o));break;case this.N_POLE:i=-i;case this.S_POLE:c=Math.abs(o)<=Proj4js.common.EPSLN?this.phi0:Math.asin(this.mode==this.S_POLE?-q:q),b=0==h&&0==i?0:Math.atan2(h,i)}a.x=Proj4js.common.adjust_lon(b+this.long0),a.y=c}else{switch(f=Math.sqrt(h*h+i*i),this.mode){case this.OBLIQ:case this.EQUIT:j=2*Math.atan2(f*this.cosX1,this.akm1),d=Math.cos(j),e=Math.sin(j),k=0==f?Math.asin(d*this.sinX1):Math.asin(d*this.sinX1+i*e*this.cosX1/f),j=Math.tan(.5*(Proj4js.common.HALF_PI+k)),h*=e,i=f*this.cosX1*d-i*this.sinX1*e,m=Proj4js.common.HALF_PI,l=.5*this.e;break;case this.N_POLE:i=-i;case this.S_POLE:j=-f/this.akm1,k=Proj4js.common.HALF_PI-2*Math.atan(j),m=-Proj4js.common.HALF_PI,l=-.5*this.e}for(g=this.NITER;g--;k=c)if(e=this.e*Math.sin(k),c=2*Math.atan(j*Math.pow((1+e)/(1-e),l))-m,Math.abs(k-c)<this.CONV)return this.mode==this.S_POLE&&(c=-c),b=0==h&&0==i?0:Math.atan2(h,i),a.x=Proj4js.common.adjust_lon(b+this.long0),a.y=c,a}}};
\ No newline at end of file
diff --git a/web/ext/proj/proj4js-2.3.3-1/proj4.js b/web/ext/proj/proj4js-2.3.3-1/proj4.js
new file mode 100644
index 000000000..e94734552
--- /dev/null
+++ b/web/ext/proj/proj4js-2.3.3-1/proj4.js
@@ -0,0 +1,3 @@
+!function(a){if("object"==typeof exports)module.exports=a();else if("function"==typeof define&&define.amd)define(a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.proj4=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){function Point(a,b,c){if(!(this instanceof Point))return new Point(a,b,c);if(Array.isArray(a))this.x=a[0],this.y=a[1],this.z=a[2]||0;else if("object"==typeof a)this.x=a.x,this.y=a.y,this.z=a.z||0;else if("string"==typeof a&&"undefined"==typeof b){var d=a.split(",");this.x=parseFloat(d[0],10),this.y=parseFloat(d[1],10),this.z=parseFloat(d[2],10)||0}else this.x=a,this.y=b,this.z=c||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}var c=a("mgrs");Point.fromMGRS=function(a){return new Point(c.toPoint(a))},Point.prototype.toMGRS=function(a){return c.forward([this.x,this.y],a)},b.exports=Point},{mgrs:66}],2:[function(a,b){function Projection(a,b){if(!(this instanceof Projection))return new Projection(a);b=b||function(a){if(a)throw a};var e=c(a);if("object"!=typeof e)return void b(a);var g=f(e),h=Projection.projections.get(g.projName);h?(d(this,g),d(this,h),this.init(),b(null,this)):b(a)}var c=a("./parseCode"),d=a("./extend"),e=a("./projections"),f=a("./deriveConstants");Projection.projections=e,Projection.projections.start(),b.exports=Projection},{"./deriveConstants":32,"./extend":33,"./parseCode":36,"./projections":38}],3:[function(a,b){b.exports=function(a,b,c){var d,e,f,g=c.x,h=c.y,i=c.z||0;for(f=0;3>f;f++)if(!b||2!==f||void 0!==c.z)switch(0===f?(d=g,e="x"):1===f?(d=h,e="y"):(d=i,e="z"),a.axis[f]){case"e":c[e]=d;break;case"w":c[e]=-d;break;case"n":c[e]=d;break;case"s":c[e]=-d;break;case"u":void 0!==c[e]&&(c.z=d);break;case"d":void 0!==c[e]&&(c.z=-d);break;default:return null}return c}},{}],4:[function(a,b){var c=Math.PI/2,d=a("./sign");b.exports=function(a){return Math.abs(a)<c?a:a-d(a)*Math.PI}},{"./sign":21}],5:[function(a,b){var c=2*Math.PI,d=3.14159265359,e=a("./sign");b.exports=function(a){return Math.abs(a)<=d?a:a-e(a)*c}},{"./sign":21}],6:[function(a,b){b.exports=function(a){return Math.abs(a)>1&&(a=a>1?1:-1),Math.asin(a)}},{}],7:[function(a,b){b.exports=function(a){return 1-.25*a*(1+a/16*(3+1.25*a))}},{}],8:[function(a,b){b.exports=function(a){return.375*a*(1+.25*a*(1+.46875*a))}},{}],9:[function(a,b){b.exports=function(a){return.05859375*a*a*(1+.75*a)}},{}],10:[function(a,b){b.exports=function(a){return a*a*a*(35/3072)}},{}],11:[function(a,b){b.exports=function(a,b,c){var d=b*c;return a/Math.sqrt(1-d*d)}},{}],12:[function(a,b){b.exports=function(a,b,c,d,e){var f,g;f=a/b;for(var h=0;15>h;h++)if(g=(a-(b*f-c*Math.sin(2*f)+d*Math.sin(4*f)-e*Math.sin(6*f)))/(b-2*c*Math.cos(2*f)+4*d*Math.cos(4*f)-6*e*Math.cos(6*f)),f+=g,Math.abs(g)<=1e-10)return f;return 0/0}},{}],13:[function(a,b){var c=Math.PI/2;b.exports=function(a,b){var d=1-(1-a*a)/(2*a)*Math.log((1-a)/(1+a));if(Math.abs(Math.abs(b)-d)<1e-6)return 0>b?-1*c:c;for(var e,f,g,h,i=Math.asin(.5*b),j=0;30>j;j++)if(f=Math.sin(i),g=Math.cos(i),h=a*f,e=Math.pow(1-h*h,2)/(2*g)*(b/(1-a*a)-f/(1-h*h)+.5/a*Math.log((1-h)/(1+h))),i+=e,Math.abs(e)<=1e-10)return i;return 0/0}},{}],14:[function(a,b){b.exports=function(a,b,c,d,e){return a*e-b*Math.sin(2*e)+c*Math.sin(4*e)-d*Math.sin(6*e)}},{}],15:[function(a,b){b.exports=function(a,b,c){var d=a*b;return c/Math.sqrt(1-d*d)}},{}],16:[function(a,b){var c=Math.PI/2;b.exports=function(a,b){for(var d,e,f=.5*a,g=c-2*Math.atan(b),h=0;15>=h;h++)if(d=a*Math.sin(g),e=c-2*Math.atan(b*Math.pow((1-d)/(1+d),f))-g,g+=e,Math.abs(e)<=1e-10)return g;return-9999}},{}],17:[function(a,b){var c=1,d=.25,e=.046875,f=.01953125,g=.01068115234375,h=.75,i=.46875,j=.013020833333333334,k=.007120768229166667,l=.3645833333333333,m=.005696614583333333,n=.3076171875;b.exports=function(a){var b=[];b[0]=c-a*(d+a*(e+a*(f+a*g))),b[1]=a*(h-a*(e+a*(f+a*g)));var o=a*a;return b[2]=o*(i-a*(j+a*k)),o*=a,b[3]=o*(l-a*m),b[4]=o*a*n,b}},{}],18:[function(a,b){var c=a("./pj_mlfn"),d=1e-10,e=20;b.exports=function(a,b,f){for(var g=1/(1-b),h=a,i=e;i;--i){var j=Math.sin(h),k=1-b*j*j;if(k=(c(h,j,Math.cos(h),f)-a)*k*Math.sqrt(k)*g,h-=k,Math.abs(k)<d)return h}return h}},{"./pj_mlfn":19}],19:[function(a,b){b.exports=function(a,b,c,d){return c*=b,b*=b,d[0]*a-c*(d[1]+b*(d[2]+b*(d[3]+b*d[4])))}},{}],20:[function(a,b){b.exports=function(a,b){var c;return a>1e-7?(c=a*b,(1-a*a)*(b/(1-c*c)-.5/a*Math.log((1-c)/(1+c)))):2*b}},{}],21:[function(a,b){b.exports=function(a){return 0>a?-1:1}},{}],22:[function(a,b){b.exports=function(a,b){return Math.pow((1-a)/(1+a),b)}},{}],23:[function(a,b){b.exports=function(a){var b={x:a[0],y:a[1]};return a.length>2&&(b.z=a[2]),a.length>3&&(b.m=a[3]),b}},{}],24:[function(a,b){var c=Math.PI/2;b.exports=function(a,b,d){var e=a*d,f=.5*a;return e=Math.pow((1-e)/(1+e),f),Math.tan(.5*(c-b))/e}},{}],25:[function(a,b,c){c.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},c.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},c.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},c.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},c.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},c.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},c.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},c.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},c.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},c.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},c.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},c.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},c.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},c.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},c.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},c.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"}},{}],26:[function(a,b,c){c.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},c.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},c.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},c.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},c.airy={a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},c.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},c.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},c.mod_airy={a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},c.andrae={a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},c.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},c.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},c.bessel={a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},c.bess_nam={a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},c.clrk66={a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},c.clrk80={a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},c.clrk58={a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},c.CPM={a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},c.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},c.engelis={a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},c.evrst30={a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},c.evrst48={a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},c.evrst56={a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},c.evrst69={a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},c.evrstSS={a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},c.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},c.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},c.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},c.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},c.hough={a:6378270,rf:297,ellipseName:"Hough"},c.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},c.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},c.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},c.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},c.new_intl={a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},c.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},c.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},c.SEasia={a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},c.walbeck={a:6376896,b:6355834.8467,ellipseName:"Walbeck"},c.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},c.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},c.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"},c.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"},c.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},{}],27:[function(a,b,c){c.greenwich=0,c.lisbon=-9.131906111111,c.paris=2.337229166667,c.bogota=-74.080916666667,c.madrid=-3.687938888889,c.rome=12.452333333333,c.bern=7.439583333333,c.jakarta=106.807719444444,c.ferro=-17.666666666667,c.brussels=4.367975,c.stockholm=18.058277777778,c.athens=23.7163375,c.oslo=10.722916666667},{}],28:[function(a,b){function c(a,b,c){var d;return Array.isArray(c)?(d=f(a,b,c),3===c.length?[d.x,d.y,d.z]:[d.x,d.y]):f(a,b,c)}function d(a){return a instanceof e?a:a.oProj?a.oProj:e(a)}function proj4(a,b,e){a=d(a);var f,h=!1;return"undefined"==typeof b?(b=a,a=g,h=!0):("undefined"!=typeof b.x||Array.isArray(b))&&(e=b,b=a,a=g,h=!0),b=d(b),e?c(a,b,e):(f={forward:function(d){return c(a,b,d)},inverse:function(d){return c(b,a,d)}},h&&(f.oProj=b),f)}var e=a("./Proj"),f=a("./transform"),g=e("WGS84");b.exports=proj4},{"./Proj":2,"./transform":64}],29:[function(a,b){var c=Math.PI/2,d=1,e=2,f=3,g=4,h=5,i=484813681109536e-20,j=1.0026,k=.3826834323650898,l=function(a){if(!(this instanceof l))return new l(a);if(this.datum_type=g,a){if(a.datumCode&&"none"===a.datumCode&&(this.datum_type=h),a.datum_params){for(var b=0;b<a.datum_params.length;b++)a.datum_params[b]=parseFloat(a.datum_params[b]);(0!==a.datum_params[0]||0!==a.datum_params[1]||0!==a.datum_params[2])&&(this.datum_type=d),a.datum_params.length>3&&(0!==a.datum_params[3]||0!==a.datum_params[4]||0!==a.datum_params[5]||0!==a.datum_params[6])&&(this.datum_type=e,a.datum_params[3]*=i,a.datum_params[4]*=i,a.datum_params[5]*=i,a.datum_params[6]=a.datum_params[6]/1e6+1)}this.datum_type=a.grids?f:this.datum_type,this.a=a.a,this.b=a.b,this.es=a.es,this.ep2=a.ep2,this.datum_params=a.datum_params,this.datum_type===f&&(this.grids=a.grids)}};l.prototype={compare_datums:function(a){return this.datum_type!==a.datum_type?!1:this.a!==a.a||Math.abs(this.es-a.es)>5e-11?!1:this.datum_type===d?this.datum_params[0]===a.datum_params[0]&&this.datum_params[1]===a.datum_params[1]&&this.datum_params[2]===a.datum_params[2]:this.datum_type===e?this.datum_params[0]===a.datum_params[0]&&this.datum_params[1]===a.datum_params[1]&&this.datum_params[2]===a.datum_params[2]&&this.datum_params[3]===a.datum_params[3]&&this.datum_params[4]===a.datum_params[4]&&this.datum_params[5]===a.datum_params[5]&&this.datum_params[6]===a.datum_params[6]:this.datum_type===f||a.datum_type===f?this.nadgrids===a.nadgrids:!0},geodetic_to_geocentric:function(a){var b,d,e,f,g,h,i,j=a.x,k=a.y,l=a.z?a.z:0,m=0;if(-c>k&&k>-1.001*c)k=-c;else if(k>c&&1.001*c>k)k=c;else if(-c>k||k>c)return null;return j>Math.PI&&(j-=2*Math.PI),g=Math.sin(k),i=Math.cos(k),h=g*g,f=this.a/Math.sqrt(1-this.es*h),b=(f+l)*i*Math.cos(j),d=(f+l)*i*Math.sin(j),e=(f*(1-this.es)+l)*g,a.x=b,a.y=d,a.z=e,m},geocentric_to_geodetic:function(a){var b,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=1e-12,u=t*t,v=30,w=a.x,x=a.y,y=a.z?a.z:0;if(o=!1,b=Math.sqrt(w*w+x*x),d=Math.sqrt(w*w+x*x+y*y),b/this.a<t){if(o=!0,q=0,d/this.a<t)return r=c,void(s=-this.b)}else q=Math.atan2(x,w);e=y/d,f=b/d,g=1/Math.sqrt(1-this.es*(2-this.es)*f*f),j=f*(1-this.es)*g,k=e*g,p=0;do p++,i=this.a/Math.sqrt(1-this.es*k*k),s=b*j+y*k-i*(1-this.es*k*k),h=this.es*i/(i+s),g=1/Math.sqrt(1-h*(2-h)*f*f),l=f*(1-h)*g,m=e*g,n=m*j-l*k,j=l,k=m;while(n*n>u&&v>p);return r=Math.atan(m/Math.abs(l)),a.x=q,a.y=r,a.z=s,a},geocentric_to_geodetic_noniter:function(a){var b,d,e,f,g,h,i,l,m,n,o,p,q,r,s,t,u,v=a.x,w=a.y,x=a.z?a.z:0;if(v=parseFloat(v),w=parseFloat(w),x=parseFloat(x),u=!1,0!==v)b=Math.atan2(w,v);else if(w>0)b=c;else if(0>w)b=-c;else if(u=!0,b=0,x>0)d=c;else{if(!(0>x))return d=c,void(e=-this.b);d=-c}return g=v*v+w*w,f=Math.sqrt(g),h=x*j,l=Math.sqrt(h*h+g),n=h/l,p=f/l,o=n*n*n,i=x+this.b*this.ep2*o,t=f-this.a*this.es*p*p*p,m=Math.sqrt(i*i+t*t),q=i/m,r=t/m,s=this.a/Math.sqrt(1-this.es*q*q),e=r>=k?f/r-s:-k>=r?f/-r-s:x/q+s*(this.es-1),u===!1&&(d=Math.atan(q/r)),a.x=b,a.y=d,a.z=e,a},geocentric_to_wgs84:function(a){if(this.datum_type===d)a.x+=this.datum_params[0],a.y+=this.datum_params[1],a.z+=this.datum_params[2];else if(this.datum_type===e){var b=this.datum_params[0],c=this.datum_params[1],f=this.datum_params[2],g=this.datum_params[3],h=this.datum_params[4],i=this.datum_params[5],j=this.datum_params[6],k=j*(a.x-i*a.y+h*a.z)+b,l=j*(i*a.x+a.y-g*a.z)+c,m=j*(-h*a.x+g*a.y+a.z)+f;a.x=k,a.y=l,a.z=m}},geocentric_from_wgs84:function(a){if(this.datum_type===d)a.x-=this.datum_params[0],a.y-=this.datum_params[1],a.z-=this.datum_params[2];else if(this.datum_type===e){var b=this.datum_params[0],c=this.datum_params[1],f=this.datum_params[2],g=this.datum_params[3],h=this.datum_params[4],i=this.datum_params[5],j=this.datum_params[6],k=(a.x-b)/j,l=(a.y-c)/j,m=(a.z-f)/j;a.x=k+i*l-h*m,a.y=-i*k+l+g*m,a.z=h*k-g*l+m}}},b.exports=l},{}],30:[function(a,b){var c=1,d=2,e=3,f=5,g=6378137,h=.006694379990141316;b.exports=function(a,b,i){function j(a){return a===c||a===d}var k,l,m;if(a.compare_datums(b))return i;if(a.datum_type===f||b.datum_type===f)return i;var n=a.a,o=a.es,p=b.a,q=b.es,r=a.datum_type;if(r===e)if(0===this.apply_gridshift(a,0,i))a.a=g,a.es=h;else{if(!a.datum_params)return a.a=n,a.es=a.es,i;for(k=1,l=0,m=a.datum_params.length;m>l;l++)k*=a.datum_params[l];if(0===k)return a.a=n,a.es=a.es,i;r=a.datum_params.length>3?d:c}return b.datum_type===e&&(b.a=g,b.es=h),(a.es!==b.es||a.a!==b.a||j(r)||j(b.datum_type))&&(a.geodetic_to_geocentric(i),j(a.datum_type)&&a.geocentric_to_wgs84(i),j(b.datum_type)&&b.geocentric_from_wgs84(i),b.geocentric_to_geodetic(i)),b.datum_type===e&&this.apply_gridshift(b,1,i),a.a=n,a.es=o,b.a=p,b.es=q,i}},{}],31:[function(a,b){function c(a){var b=this;if(2===arguments.length){var d=arguments[1];c[a]="string"==typeof d?"+"===d.charAt(0)?e(arguments[1]):f(arguments[1]):d}else if(1===arguments.length){if(Array.isArray(a))return a.map(function(a){Array.isArray(a)?c.apply(b,a):c(a)});if("string"==typeof a){if(a in c)return c[a]}else"EPSG"in a?c["EPSG:"+a.EPSG]=a:"ESRI"in a?c["ESRI:"+a.ESRI]=a:"IAU2000"in a?c["IAU2000:"+a.IAU2000]=a:console.log(a);return}}var d=a("./global"),e=a("./projString"),f=a("./wkt");d(c),b.exports=c},{"./global":34,"./projString":37,"./wkt":65}],32:[function(a,b){var c=a("./constants/Datum"),d=a("./constants/Ellipsoid"),e=a("./extend"),f=a("./datum"),g=1e-10,h=.16666666666666666,i=.04722222222222222,j=.022156084656084655;b.exports=function(a){if(a.datumCode&&"none"!==a.datumCode){var b=c[a.datumCode];b&&(a.datum_params=b.towgs84?b.towgs84.split(","):null,a.ellps=b.ellipse,a.datumName=b.datumName?b.datumName:a.datumCode)}if(!a.a){var k=d[a.ellps]?d[a.ellps]:d.WGS84;e(a,k)}return a.rf&&!a.b&&(a.b=(1-1/a.rf)*a.a),(0===a.rf||Math.abs(a.a-a.b)<g)&&(a.sphere=!0,a.b=a.a),a.a2=a.a*a.a,a.b2=a.b*a.b,a.es=(a.a2-a.b2)/a.a2,a.e=Math.sqrt(a.es),a.R_A&&(a.a*=1-a.es*(h+a.es*(i+a.es*j)),a.a2=a.a*a.a,a.b2=a.b*a.b,a.es=0),a.ep2=(a.a2-a.b2)/a.b2,a.k0||(a.k0=1),a.axis||(a.axis="enu"),a.datum||(a.datum=f(a)),a}},{"./constants/Datum":25,"./constants/Ellipsoid":26,"./datum":29,"./extend":33}],33:[function(a,b){b.exports=function(a,b){a=a||{};var c,d;if(!b)return a;for(d in b)c=b[d],void 0!==c&&(a[d]=c);return a}},{}],34:[function(a,b){b.exports=function(a){a("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),a("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),a("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +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 +no_defs"),a.WGS84=a["EPSG:4326"],a["EPSG:3785"]=a["EPSG:3857"],a.GOOGLE=a["EPSG:3857"],a["EPSG:900913"]=a["EPSG:3857"],a["EPSG:102113"]=a["EPSG:3857"]}},{}],35:[function(a,b){var proj4=a("./core");proj4.defaultDatum="WGS84",proj4.Proj=a("./Proj"),proj4.WGS84=new proj4.Proj("WGS84"),proj4.Point=a("./Point"),proj4.toPoint=a("./common/toPoint"),proj4.defs=a("./defs"),proj4.transform=a("./transform"),proj4.mgrs=a("mgrs"),proj4.version=a("../package.json").version,a("./includedProjections")(proj4),b.exports=proj4},{"../package.json":67,"./Point":1,"./Proj":2,"./common/toPoint":23,"./core":28,"./defs":31,"./includedProjections":"gWUPNW","./transform":64,mgrs:66}],36:[function(a,b){function c(a){return"string"==typeof a}function d(a){return a in h}function e(a){var b=["GEOGCS","GEOCCS","PROJCS","LOCAL_CS"];return b.reduce(function(b,c){return b+1+a.indexOf(c)},0)}function f(a){return"+"===a[0]}function g(a){return c(a)?d(a)?h[a]:e(a)?i(a):f(a)?j(a):void 0:a}var h=a("./defs"),i=a("./wkt"),j=a("./projString");b.exports=g},{"./defs":31,"./projString":37,"./wkt":65}],37:[function(a,b){var c=.017453292519943295,d=a("./constants/PrimeMeridian");b.exports=function(a){var b={},e={};a.split("+").map(function(a){return a.trim()}).filter(function(a){return a}).forEach(function(a){var b=a.split("=");b.push(!0),e[b[0].toLowerCase()]=b[1]});var f,g,h,i={proj:"projName",datum:"datumCode",rf:function(a){b.rf=parseFloat(a)},lat_0:function(a){b.lat0=a*c},lat_1:function(a){b.lat1=a*c},lat_2:function(a){b.lat2=a*c},lat_ts:function(a){b.lat_ts=a*c},lon_0:function(a){b.long0=a*c},lon_1:function(a){b.long1=a*c},lon_2:function(a){b.long2=a*c},alpha:function(a){b.alpha=parseFloat(a)*c},lonc:function(a){b.longc=a*c},x_0:function(a){b.x0=parseFloat(a)},y_0:function(a){b.y0=parseFloat(a)},k_0:function(a){b.k0=parseFloat(a)},k:function(a){b.k0=parseFloat(a)},a:function(a){b.a=parseFloat(a)},b:function(a){b.b=parseFloat(a)},r_a:function(){b.R_A=!0},zone:function(a){b.zone=parseInt(a,10)},south:function(){b.utmSouth=!0},towgs84:function(a){b.datum_params=a.split(",").map(function(a){return parseFloat(a)})},to_meter:function(a){b.to_meter=parseFloat(a)},from_greenwich:function(a){b.from_greenwich=a*c},pm:function(a){b.from_greenwich=(d[a]?d[a]:parseFloat(a))*c},nadgrids:function(a){"@null"===a?b.datumCode="none":b.nadgrids=a},axis:function(a){var c="ewnsud";3===a.length&&-1!==c.indexOf(a.substr(0,1))&&-1!==c.indexOf(a.substr(1,1))&&-1!==c.indexOf(a.substr(2,1))&&(b.axis=a)}};for(f in e)g=e[f],f in i?(h=i[f],"function"==typeof h?h(g):b[h]=g):b[f]=g;return"string"==typeof b.datumCode&&"WGS84"!==b.datumCode&&(b.datumCode=b.datumCode.toLowerCase()),b}},{"./constants/PrimeMeridian":27}],38:[function(a,b,c){function d(a,b){var c=g.length;return a.names?(g[c]=a,a.names.forEach(function(a){f[a.toLowerCase()]=c}),this):(console.log(b),!0)}var e=[a("./projections/merc"),a("./projections/longlat")],f={},g=[];c.add=d,c.get=function(a){if(!a)return!1;var b=a.toLowerCase();return"undefined"!=typeof f[b]&&g[f[b]]?g[f[b]]:void 0},c.start=function(){e.forEach(d)}},{"./projections/longlat":50,"./projections/merc":51}],39:[function(a,b,c){var d=1e-10,e=a("../common/msfnz"),f=a("../common/qsfnz"),g=a("../common/adjust_lon"),h=a("../common/asinz");c.init=function(){Math.abs(this.lat1+this.lat2)<d||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=e(this.e3,this.sin_po,this.cos_po),this.qs1=f(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=e(this.e3,this.sin_po,this.cos_po),this.qs2=f(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=f(this.e3,this.sin_po,this.cos_po),this.ns0=Math.abs(this.lat1-this.lat2)>d?(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},c.forward=function(a){var b=a.x,c=a.y;this.sin_phi=Math.sin(c),this.cos_phi=Math.cos(c);var d=f(this.e3,this.sin_phi,this.cos_phi),e=this.a*Math.sqrt(this.c-this.ns0*d)/this.ns0,h=this.ns0*g(b-this.long0),i=e*Math.sin(h)+this.x0,j=this.rh-e*Math.cos(h)+this.y0;return a.x=i,a.y=j,a},c.inverse=function(a){var b,c,d,e,f,h;return a.x-=this.x0,a.y=this.rh-a.y+this.y0,this.ns0>=0?(b=Math.sqrt(a.x*a.x+a.y*a.y),d=1):(b=-Math.sqrt(a.x*a.x+a.y*a.y),d=-1),e=0,0!==b&&(e=Math.atan2(d*a.x,d*a.y)),d=b*this.ns0/this.a,this.sphere?h=Math.asin((this.c-d*d)/(2*this.ns0)):(c=(this.c-d*d)/this.ns0,h=this.phi1z(this.e3,c)),f=g(e/this.ns0+this.long0),a.x=f,a.y=h,a},c.phi1z=function(a,b){var c,e,f,g,i,j=h(.5*b);if(d>a)return j;for(var k=a*a,l=1;25>=l;l++)if(c=Math.sin(j),e=Math.cos(j),f=a*c,g=1-f*f,i=.5*g*g/e*(b/(1-k)-c/g+.5/a*Math.log((1-f)/(1+f))),j+=i,Math.abs(i)<=1e-7)return j;return null},c.names=["Albers_Conic_Equal_Area","Albers","aea"]},{"../common/adjust_lon":5,"../common/asinz":6,"../common/msfnz":15,"../common/qsfnz":20}],40:[function(a,b,c){var d=a("../common/adjust_lon"),e=Math.PI/2,f=1e-10,g=a("../common/mlfn"),h=a("../common/e0fn"),i=a("../common/e1fn"),j=a("../common/e2fn"),k=a("../common/e3fn"),l=a("../common/gN"),m=a("../common/asinz"),n=a("../common/imlfn");c.init=function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)},c.forward=function(a){var b,c,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H=a.x,I=a.y,J=Math.sin(a.y),K=Math.cos(a.y),L=d(H-this.long0);return this.sphere?Math.abs(this.sin_p12-1)<=f?(a.x=this.x0+this.a*(e-I)*Math.sin(L),a.y=this.y0-this.a*(e-I)*Math.cos(L),a):Math.abs(this.sin_p12+1)<=f?(a.x=this.x0+this.a*(e+I)*Math.sin(L),a.y=this.y0+this.a*(e+I)*Math.cos(L),a):(B=this.sin_p12*J+this.cos_p12*K*Math.cos(L),z=Math.acos(B),A=z/Math.sin(z),a.x=this.x0+this.a*A*K*Math.sin(L),a.y=this.y0+this.a*A*(this.cos_p12*J-this.sin_p12*K*Math.cos(L)),a):(b=h(this.es),c=i(this.es),m=j(this.es),n=k(this.es),Math.abs(this.sin_p12-1)<=f?(o=this.a*g(b,c,m,n,e),p=this.a*g(b,c,m,n,I),a.x=this.x0+(o-p)*Math.sin(L),a.y=this.y0-(o-p)*Math.cos(L),a):Math.abs(this.sin_p12+1)<=f?(o=this.a*g(b,c,m,n,e),p=this.a*g(b,c,m,n,I),a.x=this.x0+(o+p)*Math.sin(L),a.y=this.y0+(o+p)*Math.cos(L),a):(q=J/K,r=l(this.a,this.e,this.sin_p12),s=l(this.a,this.e,J),t=Math.atan((1-this.es)*q+this.es*r*this.sin_p12/(s*K)),u=Math.atan2(Math.sin(L),this.cos_p12*Math.tan(t)-this.sin_p12*Math.cos(L)),C=0===u?Math.asin(this.cos_p12*Math.sin(t)-this.sin_p12*Math.cos(t)):Math.abs(Math.abs(u)-Math.PI)<=f?-Math.asin(this.cos_p12*Math.sin(t)-this.sin_p12*Math.cos(t)):Math.asin(Math.sin(L)*Math.cos(t)/Math.sin(u)),v=this.e*this.sin_p12/Math.sqrt(1-this.es),w=this.e*this.cos_p12*Math.cos(u)/Math.sqrt(1-this.es),x=v*w,y=w*w,D=C*C,E=D*C,F=E*C,G=F*C,z=r*C*(1-D*y*(1-y)/6+E/8*x*(1-2*y)+F/120*(y*(4-7*y)-3*v*v*(1-7*y))-G/48*x),a.x=this.x0+z*Math.sin(u),a.y=this.y0+z*Math.cos(u),a))},c.inverse=function(a){a.x-=this.x0,a.y-=this.y0;var b,c,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I;if(this.sphere){if(b=Math.sqrt(a.x*a.x+a.y*a.y),b>2*e*this.a)return;return c=b/this.a,o=Math.sin(c),p=Math.cos(c),q=this.long0,Math.abs(b)<=f?r=this.lat0:(r=m(p*this.sin_p12+a.y*o*this.cos_p12/b),s=Math.abs(this.lat0)-e,q=d(Math.abs(s)<=f?this.lat0>=0?this.long0+Math.atan2(a.x,-a.y):this.long0-Math.atan2(-a.x,a.y):this.long0+Math.atan2(a.x*o,b*this.cos_p12*p-a.y*this.sin_p12*o))),a.x=q,a.y=r,a}return t=h(this.es),u=i(this.es),v=j(this.es),w=k(this.es),Math.abs(this.sin_p12-1)<=f?(x=this.a*g(t,u,v,w,e),b=Math.sqrt(a.x*a.x+a.y*a.y),y=x-b,r=n(y/this.a,t,u,v,w),q=d(this.long0+Math.atan2(a.x,-1*a.y)),a.x=q,a.y=r,a):Math.abs(this.sin_p12+1)<=f?(x=this.a*g(t,u,v,w,e),b=Math.sqrt(a.x*a.x+a.y*a.y),y=b-x,r=n(y/this.a,t,u,v,w),q=d(this.long0+Math.atan2(a.x,a.y)),a.x=q,a.y=r,a):(b=Math.sqrt(a.x*a.x+a.y*a.y),B=Math.atan2(a.x,a.y),z=l(this.a,this.e,this.sin_p12),C=Math.cos(B),D=this.e*this.cos_p12*C,E=-D*D/(1-this.es),F=3*this.es*(1-E)*this.sin_p12*this.cos_p12*C/(1-this.es),G=b/z,H=G-E*(1+E)*Math.pow(G,3)/6-F*(1+3*E)*Math.pow(G,4)/24,I=1-E*H*H/2-G*H*H*H/6,A=Math.asin(this.sin_p12*Math.cos(H)+this.cos_p12*Math.sin(H)*C),q=d(this.long0+Math.asin(Math.sin(B)*Math.sin(H)/Math.cos(A))),r=Math.atan((1-this.es*I*this.sin_p12/Math.sin(A))*Math.tan(A)/(1-this.es)),a.x=q,a.y=r,a)},c.names=["Azimuthal_Equidistant","aeqd"]},{"../common/adjust_lon":5,"../common/asinz":6,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/gN":11,"../common/imlfn":12,"../common/mlfn":14}],41:[function(a,b,c){var d=a("../common/mlfn"),e=a("../common/e0fn"),f=a("../common/e1fn"),g=a("../common/e2fn"),h=a("../common/e3fn"),i=a("../common/gN"),j=a("../common/adjust_lon"),k=a("../common/adjust_lat"),l=a("../common/imlfn"),m=Math.PI/2,n=1e-10;c.init=function(){this.sphere||(this.e0=e(this.es),this.e1=f(this.es),this.e2=g(this.es),this.e3=h(this.es),this.ml0=this.a*d(this.e0,this.e1,this.e2,this.e3,this.lat0))},c.forward=function(a){var b,c,e=a.x,f=a.y;if(e=j(e-this.long0),this.sphere)b=this.a*Math.asin(Math.cos(f)*Math.sin(e)),c=this.a*(Math.atan2(Math.tan(f),Math.cos(e))-this.lat0);else{var g=Math.sin(f),h=Math.cos(f),k=i(this.a,this.e,g),l=Math.tan(f)*Math.tan(f),m=e*Math.cos(f),n=m*m,o=this.es*h*h/(1-this.es),p=this.a*d(this.e0,this.e1,this.e2,this.e3,f);b=k*m*(1-n*l*(1/6-(8-l+8*o)*n/120)),c=p-this.ml0+k*g/h*n*(.5+(5-l+6*o)*n/24)}return a.x=b+this.x0,a.y=c+this.y0,a},c.inverse=function(a){a.x-=this.x0,a.y-=this.y0;var b,c,d=a.x/this.a,e=a.y/this.a;if(this.sphere){var f=e+this.lat0;b=Math.asin(Math.sin(f)*Math.cos(d)),c=Math.atan2(Math.tan(d),Math.cos(f))}else{var g=this.ml0/this.a+e,h=l(g,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(h)-m)<=n)return a.x=this.long0,a.y=m,0>e&&(a.y*=-1),a;var o=i(this.a,this.e,Math.sin(h)),p=o*o*o/this.a/this.a*(1-this.es),q=Math.pow(Math.tan(h),2),r=d*this.a/o,s=r*r;b=h-o*Math.tan(h)/p*r*r*(.5-(1+3*q)*r*r/24),c=r*(1-s*(q/3+(1+3*q)*q*s/15))/Math.cos(h)}return a.x=j(c+this.long0),a.y=k(b),a},c.names=["Cassini","Cassini_Soldner","cass"]},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/gN":11,"../common/imlfn":12,"../common/mlfn":14}],42:[function(a,b,c){var d=a("../common/adjust_lon"),e=a("../common/qsfnz"),f=a("../common/msfnz"),g=a("../common/iqsfnz");c.init=function(){this.sphere||(this.k0=f(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},c.forward=function(a){var b,c,f=a.x,g=a.y,h=d(f-this.long0);if(this.sphere)b=this.x0+this.a*h*Math.cos(this.lat_ts),c=this.y0+this.a*Math.sin(g)/Math.cos(this.lat_ts);else{var i=e(this.e,Math.sin(g));b=this.x0+this.a*this.k0*h,c=this.y0+this.a*i*.5/this.k0}return a.x=b,a.y=c,a},c.inverse=function(a){a.x-=this.x0,a.y-=this.y0;var b,c;return this.sphere?(b=d(this.long0+a.x/this.a/Math.cos(this.lat_ts)),c=Math.asin(a.y/this.a*Math.cos(this.lat_ts))):(c=g(this.e,2*a.y*this.k0/this.a),b=d(this.long0+a.x/(this.a*this.k0))),a.x=b,a.y=c,a},c.names=["cea"]},{"../common/adjust_lon":5,"../common/iqsfnz":13,"../common/msfnz":15,"../common/qsfnz":20}],43:[function(a,b,c){var d=a("../common/adjust_lon"),e=a("../common/adjust_lat");c.init=function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},c.forward=function(a){var b=a.x,c=a.y,f=d(b-this.long0),g=e(c-this.lat0);return a.x=this.x0+this.a*f*this.rc,a.y=this.y0+this.a*g,a},c.inverse=function(a){var b=a.x,c=a.y;return a.x=d(this.long0+(b-this.x0)/(this.a*this.rc)),a.y=e(this.lat0+(c-this.y0)/this.a),a},c.names=["Equirectangular","Equidistant_Cylindrical","eqc"]},{"../common/adjust_lat":4,"../common/adjust_lon":5}],44:[function(a,b,c){var d=a("../common/e0fn"),e=a("../common/e1fn"),f=a("../common/e2fn"),g=a("../common/e3fn"),h=a("../common/msfnz"),i=a("../common/mlfn"),j=a("../common/adjust_lon"),k=a("../common/adjust_lat"),l=a("../common/imlfn"),m=1e-10;c.init=function(){Math.abs(this.lat1+this.lat2)<m||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=d(this.es),this.e1=e(this.es),this.e2=f(this.es),this.e3=g(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=h(this.e,this.sinphi,this.cosphi),this.ml1=i(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<m?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=h(this.e,this.sinphi,this.cosphi),this.ml2=i(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=i(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},c.forward=function(a){var b,c=a.x,d=a.y;if(this.sphere)b=this.a*(this.g-d);else{var e=i(this.e0,this.e1,this.e2,this.e3,d);b=this.a*(this.g-e)}var f=this.ns*j(c-this.long0),g=this.x0+b*Math.sin(f),h=this.y0+this.rh-b*Math.cos(f);return a.x=g,a.y=h,a},c.inverse=function(a){a.x-=this.x0,a.y=this.rh-a.y+this.y0;var b,c,d,e;this.ns>=0?(c=Math.sqrt(a.x*a.x+a.y*a.y),b=1):(c=-Math.sqrt(a.x*a.x+a.y*a.y),b=-1);var f=0;if(0!==c&&(f=Math.atan2(b*a.x,b*a.y)),this.sphere)return e=j(this.long0+f/this.ns),d=k(this.g-c/this.a),a.x=e,a.y=d,a;var g=this.g-c/this.a;return d=l(g,this.e0,this.e1,this.e2,this.e3),e=j(this.long0+f/this.ns),a.x=e,a.y=d,a},c.names=["Equidistant_Conic","eqdc"]},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/imlfn":12,"../common/mlfn":14,"../common/msfnz":15}],45:[function(a,b,c){var d=Math.PI/4,e=a("../common/srat"),f=Math.PI/2,g=20;c.init=function(){var a=Math.sin(this.lat0),b=Math.cos(this.lat0);b*=b,this.rc=Math.sqrt(1-this.es)/(1-this.es*a*a),this.C=Math.sqrt(1+this.es*b*b/(1-this.es)),this.phic0=Math.asin(a/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+d)/(Math.pow(Math.tan(.5*this.lat0+d),this.C)*e(this.e*a,this.ratexp))},c.forward=function(a){var b=a.x,c=a.y;return a.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*c+d),this.C)*e(this.e*Math.sin(c),this.ratexp))-f,a.x=this.C*b,a},c.inverse=function(a){for(var b=1e-14,c=a.x/this.C,h=a.y,i=Math.pow(Math.tan(.5*h+d)/this.K,1/this.C),j=g;j>0&&(h=2*Math.atan(i*e(this.e*Math.sin(a.y),-.5*this.e))-f,!(Math.abs(h-a.y)<b));--j)a.y=h;return j?(a.x=c,a.y=h,a):null},c.names=["gauss"]},{"../common/srat":22}],46:[function(a,b,c){var d=a("../common/adjust_lon"),e=1e-10,f=a("../common/asinz");c.init=function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},c.forward=function(a){var b,c,f,g,h,i,j,k,l=a.x,m=a.y;return f=d(l-this.long0),b=Math.sin(m),c=Math.cos(m),g=Math.cos(f),i=this.sin_p14*b+this.cos_p14*c*g,h=1,i>0||Math.abs(i)<=e?(j=this.x0+this.a*h*c*Math.sin(f)/i,k=this.y0+this.a*h*(this.cos_p14*b-this.sin_p14*c*g)/i):(j=this.x0+this.infinity_dist*c*Math.sin(f),k=this.y0+this.infinity_dist*(this.cos_p14*b-this.sin_p14*c*g)),a.x=j,a.y=k,a
+},c.inverse=function(a){var b,c,e,g,h,i;return a.x=(a.x-this.x0)/this.a,a.y=(a.y-this.y0)/this.a,a.x/=this.k0,a.y/=this.k0,(b=Math.sqrt(a.x*a.x+a.y*a.y))?(g=Math.atan2(b,this.rc),c=Math.sin(g),e=Math.cos(g),i=f(e*this.sin_p14+a.y*c*this.cos_p14/b),h=Math.atan2(a.x*c,b*this.cos_p14*e-a.y*this.sin_p14*c),h=d(this.long0+h)):(i=this.phic0,h=0),a.x=h,a.y=i,a},c.names=["gnom"]},{"../common/adjust_lon":5,"../common/asinz":6}],47:[function(a,b,c){var d=a("../common/adjust_lon");c.init=function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},c.forward=function(a){var b,c,e,f,g,h,i,j=a.x,k=a.y,l=d(j-this.long0);return b=Math.pow((1+this.e*Math.sin(k))/(1-this.e*Math.sin(k)),this.alfa*this.e/2),c=2*(Math.atan(this.k*Math.pow(Math.tan(k/2+this.s45),this.alfa)/b)-this.s45),e=-l*this.alfa,f=Math.asin(Math.cos(this.ad)*Math.sin(c)+Math.sin(this.ad)*Math.cos(c)*Math.cos(e)),g=Math.asin(Math.cos(c)*Math.sin(e)/Math.cos(f)),h=this.n*g,i=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(f/2+this.s45),this.n),a.y=i*Math.cos(h)/1,a.x=i*Math.sin(h)/1,this.czech||(a.y*=-1,a.x*=-1),a},c.inverse=function(a){var b,c,d,e,f,g,h,i,j=a.x;a.x=a.y,a.y=j,this.czech||(a.y*=-1,a.x*=-1),g=Math.sqrt(a.x*a.x+a.y*a.y),f=Math.atan2(a.y,a.x),e=f/Math.sin(this.s0),d=2*(Math.atan(Math.pow(this.ro0/g,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),b=Math.asin(Math.cos(this.ad)*Math.sin(d)-Math.sin(this.ad)*Math.cos(d)*Math.cos(e)),c=Math.asin(Math.cos(d)*Math.sin(e)/Math.cos(b)),a.x=this.long0-c/this.alfa,h=b,i=0;var k=0;do a.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(b/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.e/2))-this.s45),Math.abs(h-a.y)<1e-10&&(i=1),h=a.y,k+=1;while(0===i&&15>k);return k>=15?null:a},c.names=["Krovak","krovak"]},{"../common/adjust_lon":5}],48:[function(a,b,c){var d=Math.PI/2,e=Math.PI/4,f=1e-10,g=a("../common/qsfnz"),h=a("../common/adjust_lon");c.S_POLE=1,c.N_POLE=2,c.EQUIT=3,c.OBLIQ=4,c.init=function(){var a=Math.abs(this.lat0);if(this.mode=Math.abs(a-d)<f?this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(a)<f?this.EQUIT:this.OBLIQ,this.es>0){var b;switch(this.qp=g(this.e,1),this.mmf=.5/(1-this.es),this.apa=this.authset(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),b=Math.sin(this.lat0),this.sinb1=g(this.e,b)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*b*b)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},c.forward=function(a){var b,c,i,j,k,l,m,n,o,p,q=a.x,r=a.y;if(q=h(q-this.long0),this.sphere){if(k=Math.sin(r),p=Math.cos(r),i=Math.cos(q),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(c=this.mode===this.EQUIT?1+p*i:1+this.sinph0*k+this.cosph0*p*i,f>=c)return null;c=Math.sqrt(2/c),b=c*p*Math.sin(q),c*=this.mode===this.EQUIT?k:this.cosph0*k-this.sinph0*p*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(r+this.phi0)<f)return null;c=e-.5*r,c=2*(this.mode===this.S_POLE?Math.cos(c):Math.sin(c)),b=c*Math.sin(q),c*=i}}else{switch(m=0,n=0,o=0,i=Math.cos(q),j=Math.sin(q),k=Math.sin(r),l=g(this.e,k),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(m=l/this.qp,n=Math.sqrt(1-m*m)),this.mode){case this.OBLIQ:o=1+this.sinb1*m+this.cosb1*n*i;break;case this.EQUIT:o=1+n*i;break;case this.N_POLE:o=d+r,l=this.qp-l;break;case this.S_POLE:o=r-d,l=this.qp+l}if(Math.abs(o)<f)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:o=Math.sqrt(2/o),c=this.mode===this.OBLIQ?this.ymf*o*(this.cosb1*m-this.sinb1*n*i):(o=Math.sqrt(2/(1+n*i)))*m*this.ymf,b=this.xmf*o*n*j;break;case this.N_POLE:case this.S_POLE:l>=0?(b=(o=Math.sqrt(l))*j,c=i*(this.mode===this.S_POLE?o:-o)):b=c=0}}return a.x=this.a*b+this.x0,a.y=this.a*c+this.y0,a},c.inverse=function(a){a.x-=this.x0,a.y-=this.y0;var b,c,e,g,i,j,k,l=a.x/this.a,m=a.y/this.a;if(this.sphere){var n,o=0,p=0;if(n=Math.sqrt(l*l+m*m),c=.5*n,c>1)return null;switch(c=2*Math.asin(c),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(p=Math.sin(c),o=Math.cos(c)),this.mode){case this.EQUIT:c=Math.abs(n)<=f?0:Math.asin(m*p/n),l*=p,m=o*n;break;case this.OBLIQ:c=Math.abs(n)<=f?this.phi0:Math.asin(o*this.sinph0+m*p*this.cosph0/n),l*=p*this.cosph0,m=(o-Math.sin(c)*this.sinph0)*n;break;case this.N_POLE:m=-m,c=d-c;break;case this.S_POLE:c-=d}b=0!==m||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(l,m):0}else{if(k=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(l/=this.dd,m*=this.dd,j=Math.sqrt(l*l+m*m),f>j)return a.x=0,a.y=this.phi0,a;g=2*Math.asin(.5*j/this.rq),e=Math.cos(g),l*=g=Math.sin(g),this.mode===this.OBLIQ?(k=e*this.sinb1+m*g*this.cosb1/j,i=this.qp*k,m=j*this.cosb1*e-m*this.sinb1*g):(k=m*g/j,i=this.qp*k,m=j*e)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(m=-m),i=l*l+m*m,!i)return a.x=0,a.y=this.phi0,a;k=1-i/this.qp,this.mode===this.S_POLE&&(k=-k)}b=Math.atan2(l,m),c=this.authlat(Math.asin(k),this.apa)}return a.x=h(this.long0+b),a.y=c,a},c.P00=.3333333333333333,c.P01=.17222222222222222,c.P02=.10257936507936508,c.P10=.06388888888888888,c.P11=.0664021164021164,c.P20=.016415012942191543,c.authset=function(a){var b,c=[];return c[0]=a*this.P00,b=a*a,c[0]+=b*this.P01,c[1]=b*this.P10,b*=a,c[0]+=b*this.P02,c[1]+=b*this.P11,c[2]=b*this.P20,c},c.authlat=function(a,b){var c=a+a;return a+b[0]*Math.sin(c)+b[1]*Math.sin(c+c)+b[2]*Math.sin(c+c+c)},c.names=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"]},{"../common/adjust_lon":5,"../common/qsfnz":20}],49:[function(a,b,c){var d=1e-10,e=a("../common/msfnz"),f=a("../common/tsfnz"),g=Math.PI/2,h=a("../common/sign"),i=a("../common/adjust_lon"),j=a("../common/phi2z");c.init=function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<d)){var a=this.b/this.a;this.e=Math.sqrt(1-a*a);var b=Math.sin(this.lat1),c=Math.cos(this.lat1),g=e(this.e,b,c),h=f(this.e,this.lat1,b),i=Math.sin(this.lat2),j=Math.cos(this.lat2),k=e(this.e,i,j),l=f(this.e,this.lat2,i),m=f(this.e,this.lat0,Math.sin(this.lat0));this.ns=Math.abs(this.lat1-this.lat2)>d?Math.log(g/k)/Math.log(h/l):b,isNaN(this.ns)&&(this.ns=b),this.f0=g/(this.ns*Math.pow(h,this.ns)),this.rh=this.a*this.f0*Math.pow(m,this.ns),this.title||(this.title="Lambert Conformal Conic")}},c.forward=function(a){var b=a.x,c=a.y;Math.abs(2*Math.abs(c)-Math.PI)<=d&&(c=h(c)*(g-2*d));var e,j,k=Math.abs(Math.abs(c)-g);if(k>d)e=f(this.e,c,Math.sin(c)),j=this.a*this.f0*Math.pow(e,this.ns);else{if(k=c*this.ns,0>=k)return null;j=0}var l=this.ns*i(b-this.long0);return a.x=this.k0*j*Math.sin(l)+this.x0,a.y=this.k0*(this.rh-j*Math.cos(l))+this.y0,a},c.inverse=function(a){var b,c,d,e,f,h=(a.x-this.x0)/this.k0,k=this.rh-(a.y-this.y0)/this.k0;this.ns>0?(b=Math.sqrt(h*h+k*k),c=1):(b=-Math.sqrt(h*h+k*k),c=-1);var l=0;if(0!==b&&(l=Math.atan2(c*h,c*k)),0!==b||this.ns>0){if(c=1/this.ns,d=Math.pow(b/(this.a*this.f0),c),e=j(this.e,d),-9999===e)return null}else e=-g;return f=i(l/this.ns+this.long0),a.x=f,a.y=e,a},c.names=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"]},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/sign":21,"../common/tsfnz":24}],50:[function(a,b,c){function d(a){return a}c.init=function(){},c.forward=d,c.inverse=d,c.names=["longlat","identity"]},{}],51:[function(a,b,c){var d=a("../common/msfnz"),e=Math.PI/2,f=1e-10,g=57.29577951308232,h=a("../common/adjust_lon"),i=Math.PI/4,j=a("../common/tsfnz"),k=a("../common/phi2z");c.init=function(){var a=this.b/this.a;this.es=1-a*a,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.k0=this.sphere?Math.cos(this.lat_ts):d(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k0=this.k?this.k:1)},c.forward=function(a){var b=a.x,c=a.y;if(c*g>90&&-90>c*g&&b*g>180&&-180>b*g)return null;var d,k;if(Math.abs(Math.abs(c)-e)<=f)return null;if(this.sphere)d=this.x0+this.a*this.k0*h(b-this.long0),k=this.y0+this.a*this.k0*Math.log(Math.tan(i+.5*c));else{var l=Math.sin(c),m=j(this.e,c,l);d=this.x0+this.a*this.k0*h(b-this.long0),k=this.y0-this.a*this.k0*Math.log(m)}return a.x=d,a.y=k,a},c.inverse=function(a){var b,c,d=a.x-this.x0,f=a.y-this.y0;if(this.sphere)c=e-2*Math.atan(Math.exp(-f/(this.a*this.k0)));else{var g=Math.exp(-f/(this.a*this.k0));if(c=k(this.e,g),-9999===c)return null}return b=h(this.long0+d/(this.a*this.k0)),a.x=b,a.y=c,a},c.names=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/tsfnz":24}],52:[function(a,b,c){var d=a("../common/adjust_lon");c.init=function(){},c.forward=function(a){var b=a.x,c=a.y,e=d(b-this.long0),f=this.x0+this.a*e,g=this.y0+this.a*Math.log(Math.tan(Math.PI/4+c/2.5))*1.25;return a.x=f,a.y=g,a},c.inverse=function(a){a.x-=this.x0,a.y-=this.y0;var b=d(this.long0+a.x/this.a),c=2.5*(Math.atan(Math.exp(.8*a.y/this.a))-Math.PI/4);return a.x=b,a.y=c,a},c.names=["Miller_Cylindrical","mill"]},{"../common/adjust_lon":5}],53:[function(a,b,c){var d=a("../common/adjust_lon"),e=1e-10;c.init=function(){},c.forward=function(a){for(var b=a.x,c=a.y,f=d(b-this.long0),g=c,h=Math.PI*Math.sin(c),i=0;!0;i++){var j=-(g+Math.sin(g)-h)/(1+Math.cos(g));if(g+=j,Math.abs(j)<e)break}g/=2,Math.PI/2-Math.abs(c)<e&&(f=0);var k=.900316316158*this.a*f*Math.cos(g)+this.x0,l=1.4142135623731*this.a*Math.sin(g)+this.y0;return a.x=k,a.y=l,a},c.inverse=function(a){var b,c;a.x-=this.x0,a.y-=this.y0,c=a.y/(1.4142135623731*this.a),Math.abs(c)>.999999999999&&(c=.999999999999),b=Math.asin(c);var e=d(this.long0+a.x/(.900316316158*this.a*Math.cos(b)));e<-Math.PI&&(e=-Math.PI),e>Math.PI&&(e=Math.PI),c=(2*b+Math.sin(2*b))/Math.PI,Math.abs(c)>1&&(c=1);var f=Math.asin(c);return a.x=e,a.y=f,a},c.names=["Mollweide","moll"]},{"../common/adjust_lon":5}],54:[function(a,b,c){var d=484813681109536e-20;c.iterations=1,c.init=function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},c.forward=function(a){var b,c=a.x,e=a.y,f=e-this.lat0,g=c-this.long0,h=f/d*1e-5,i=g,j=1,k=0;for(b=1;10>=b;b++)j*=h,k+=this.A[b]*j;var l,m,n=k,o=i,p=1,q=0,r=0,s=0;for(b=1;6>=b;b++)l=p*n-q*o,m=q*n+p*o,p=l,q=m,r=r+this.B_re[b]*p-this.B_im[b]*q,s=s+this.B_im[b]*p+this.B_re[b]*q;return a.x=s*this.a+this.x0,a.y=r*this.a+this.y0,a},c.inverse=function(a){var b,c,e,f=a.x,g=a.y,h=f-this.x0,i=g-this.y0,j=i/this.a,k=h/this.a,l=1,m=0,n=0,o=0;for(b=1;6>=b;b++)c=l*j-m*k,e=m*j+l*k,l=c,m=e,n=n+this.C_re[b]*l-this.C_im[b]*m,o=o+this.C_im[b]*l+this.C_re[b]*m;for(var p=0;p<this.iterations;p++){var q,r,s=n,t=o,u=j,v=k;for(b=2;6>=b;b++)q=s*n-t*o,r=t*n+s*o,s=q,t=r,u+=(b-1)*(this.B_re[b]*s-this.B_im[b]*t),v+=(b-1)*(this.B_im[b]*s+this.B_re[b]*t);s=1,t=0;var w=this.B_re[1],x=this.B_im[1];for(b=2;6>=b;b++)q=s*n-t*o,r=t*n+s*o,s=q,t=r,w+=b*(this.B_re[b]*s-this.B_im[b]*t),x+=b*(this.B_im[b]*s+this.B_re[b]*t);var y=w*w+x*x;n=(u*w+v*x)/y,o=(v*w-u*x)/y}var z=n,A=o,B=1,C=0;for(b=1;9>=b;b++)B*=z,C+=this.D[b]*B;var D=this.lat0+C*d*1e5,E=this.long0+A;return a.x=E,a.y=D,a},c.names=["New_Zealand_Map_Grid","nzmg"]},{}],55:[function(a,b,c){var d=a("../common/tsfnz"),e=a("../common/adjust_lon"),f=a("../common/phi2z"),g=Math.PI/2,h=Math.PI/4,i=1e-10;c.init=function(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var a=Math.sin(this.lat0),b=Math.cos(this.lat0),c=this.e*a;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(b,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-c*c);var f=d(this.e,this.lat0,a),g=this.bl/b*Math.sqrt((1-this.es)/(1-c*c));1>g*g&&(g=1);var h,i;if(isNaN(this.longc)){var j=d(this.e,this.lat1,Math.sin(this.lat1)),k=d(this.e,this.lat2,Math.sin(this.lat2));this.el=this.lat0>=0?(g+Math.sqrt(g*g-1))*Math.pow(f,this.bl):(g-Math.sqrt(g*g-1))*Math.pow(f,this.bl);var l=Math.pow(j,this.bl),m=Math.pow(k,this.bl);h=this.el/l,i=.5*(h-1/h);var n=(this.el*this.el-m*l)/(this.el*this.el+m*l),o=(m-l)/(m+l),p=e(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(n*Math.tan(.5*this.bl*p)/o)/this.bl,this.long0=e(this.long0);var q=e(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*q)/i),this.alpha=Math.asin(g*Math.sin(this.gamma0))}else h=this.lat0>=0?g+Math.sqrt(g*g-1):g-Math.sqrt(g*g-1),this.el=h*Math.pow(f,this.bl),i=.5*(h-1/h),this.gamma0=Math.asin(Math.sin(this.alpha)/g),this.long0=this.longc-Math.asin(i*Math.tan(this.gamma0))/this.bl;this.uc=this.no_off?0:this.lat0>=0?this.al/this.bl*Math.atan2(Math.sqrt(g*g-1),Math.cos(this.alpha)):-1*this.al/this.bl*Math.atan2(Math.sqrt(g*g-1),Math.cos(this.alpha))},c.forward=function(a){var b,c,f,j=a.x,k=a.y,l=e(j-this.long0);if(Math.abs(Math.abs(k)-g)<=i)f=k>0?-1:1,c=this.al/this.bl*Math.log(Math.tan(h+f*this.gamma0*.5)),b=-1*f*g*this.al/this.bl;else{var m=d(this.e,k,Math.sin(k)),n=this.el/Math.pow(m,this.bl),o=.5*(n-1/n),p=.5*(n+1/n),q=Math.sin(this.bl*l),r=(o*Math.sin(this.gamma0)-q*Math.cos(this.gamma0))/p;c=Math.abs(Math.abs(r)-1)<=i?Number.POSITIVE_INFINITY:.5*this.al*Math.log((1-r)/(1+r))/this.bl,b=Math.abs(Math.cos(this.bl*l))<=i?this.al*this.bl*l:this.al*Math.atan2(o*Math.cos(this.gamma0)+q*Math.sin(this.gamma0),Math.cos(this.bl*l))/this.bl}return this.no_rot?(a.x=this.x0+b,a.y=this.y0+c):(b-=this.uc,a.x=this.x0+c*Math.cos(this.alpha)+b*Math.sin(this.alpha),a.y=this.y0+b*Math.cos(this.alpha)-c*Math.sin(this.alpha)),a},c.inverse=function(a){var b,c;this.no_rot?(c=a.y-this.y0,b=a.x-this.x0):(c=(a.x-this.x0)*Math.cos(this.alpha)-(a.y-this.y0)*Math.sin(this.alpha),b=(a.y-this.y0)*Math.cos(this.alpha)+(a.x-this.x0)*Math.sin(this.alpha),b+=this.uc);var d=Math.exp(-1*this.bl*c/this.al),h=.5*(d-1/d),j=.5*(d+1/d),k=Math.sin(this.bl*b/this.al),l=(k*Math.cos(this.gamma0)+h*Math.sin(this.gamma0))/j,m=Math.pow(this.el/Math.sqrt((1+l)/(1-l)),1/this.bl);return Math.abs(l-1)<i?(a.x=this.long0,a.y=g):Math.abs(l+1)<i?(a.x=this.long0,a.y=-1*g):(a.y=f(this.e,m),a.x=e(this.long0-Math.atan2(h*Math.cos(this.gamma0)-k*Math.sin(this.gamma0),Math.cos(this.bl*b/this.al))/this.bl)),a},c.names=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"]},{"../common/adjust_lon":5,"../common/phi2z":16,"../common/tsfnz":24}],56:[function(a,b,c){var d=a("../common/e0fn"),e=a("../common/e1fn"),f=a("../common/e2fn"),g=a("../common/e3fn"),h=a("../common/adjust_lon"),i=a("../common/adjust_lat"),j=a("../common/mlfn"),k=1e-10,l=a("../common/gN"),m=20;c.init=function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=d(this.es),this.e1=e(this.es),this.e2=f(this.es),this.e3=g(this.es),this.ml0=this.a*j(this.e0,this.e1,this.e2,this.e3,this.lat0)},c.forward=function(a){var b,c,d,e=a.x,f=a.y,g=h(e-this.long0);if(d=g*Math.sin(f),this.sphere)Math.abs(f)<=k?(b=this.a*g,c=-1*this.a*this.lat0):(b=this.a*Math.sin(d)/Math.tan(f),c=this.a*(i(f-this.lat0)+(1-Math.cos(d))/Math.tan(f)));else if(Math.abs(f)<=k)b=this.a*g,c=-1*this.ml0;else{var m=l(this.a,this.e,Math.sin(f))/Math.tan(f);b=m*Math.sin(d),c=this.a*j(this.e0,this.e1,this.e2,this.e3,f)-this.ml0+m*(1-Math.cos(d))}return a.x=b+this.x0,a.y=c+this.y0,a},c.inverse=function(a){var b,c,d,e,f,g,i,l,n;if(d=a.x-this.x0,e=a.y-this.y0,this.sphere)if(Math.abs(e+this.a*this.lat0)<=k)b=h(d/this.a+this.long0),c=0;else{g=this.lat0+e/this.a,i=d*d/this.a/this.a+g*g,l=g;var o;for(f=m;f;--f)if(o=Math.tan(l),n=-1*(g*(l*o+1)-l-.5*(l*l+i)*o)/((l-g)/o-1),l+=n,Math.abs(n)<=k){c=l;break}b=h(this.long0+Math.asin(d*Math.tan(l)/this.a)/Math.sin(c))}else if(Math.abs(e+this.ml0)<=k)c=0,b=h(this.long0+d/this.a);else{g=(this.ml0+e)/this.a,i=d*d/this.a/this.a+g*g,l=g;var p,q,r,s,t;for(f=m;f;--f)if(t=this.e*Math.sin(l),p=Math.sqrt(1-t*t)*Math.tan(l),q=this.a*j(this.e0,this.e1,this.e2,this.e3,l),r=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),s=q/this.a,n=(g*(p*s+1)-s-.5*p*(s*s+i))/(this.es*Math.sin(2*l)*(s*s+i-2*g*s)/(4*p)+(g-s)*(p*r-2/Math.sin(2*l))-r),l-=n,Math.abs(n)<=k){c=l;break}p=Math.sqrt(1-this.es*Math.pow(Math.sin(c),2))*Math.tan(c),b=h(this.long0+Math.asin(d*p/this.a)/Math.sin(c))}return a.x=b,a.y=c,a},c.names=["Polyconic","poly"]},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/gN":11,"../common/mlfn":14}],57:[function(a,b,c){var d=a("../common/adjust_lon"),e=a("../common/adjust_lat"),f=a("../common/pj_enfn"),g=20,h=a("../common/pj_mlfn"),i=a("../common/pj_inv_mlfn"),j=Math.PI/2,k=1e-10,l=a("../common/asinz");c.init=function(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=f(this.es)},c.forward=function(a){var b,c,e=a.x,f=a.y;if(e=d(e-this.long0),this.sphere){if(this.m)for(var i=this.n*Math.sin(f),j=g;j;--j){var l=(this.m*f+Math.sin(f)-i)/(this.m+Math.cos(f));if(f-=l,Math.abs(l)<k)break}else f=1!==this.n?Math.asin(this.n*Math.sin(f)):f;b=this.a*this.C_x*e*(this.m+Math.cos(f)),c=this.a*this.C_y*f}else{var m=Math.sin(f),n=Math.cos(f);c=this.a*h(f,m,n,this.en),b=this.a*e*n/Math.sqrt(1-this.es*m*m)}return a.x=b,a.y=c,a},c.inverse=function(a){var b,c,f,g;return a.x-=this.x0,f=a.x/this.a,a.y-=this.y0,b=a.y/this.a,this.sphere?(b/=this.C_y,f/=this.C_x*(this.m+Math.cos(b)),this.m?b=l((this.m*b+Math.sin(b))/this.n):1!==this.n&&(b=l(Math.sin(b)/this.n)),f=d(f+this.long0),b=e(b)):(b=i(a.y/this.a,this.es,this.en),g=Math.abs(b),j>g?(g=Math.sin(b),c=this.long0+a.x*Math.sqrt(1-this.es*g*g)/(this.a*Math.cos(b)),f=d(c)):j>g-k&&(f=this.long0)),a.x=f,a.y=b,a},c.names=["Sinusoidal","sinu"]},{"../common/adjust_lat":4,"../common/adjust_lon":5,"../common/asinz":6,"../common/pj_enfn":17,"../common/pj_inv_mlfn":18,"../common/pj_mlfn":19}],58:[function(a,b,c){c.init=function(){var a=this.lat0;this.lambda0=this.long0;var b=Math.sin(a),c=this.a,d=this.rf,e=1/d,f=2*e-Math.pow(e,2),g=this.e=Math.sqrt(f);this.R=this.k0*c*Math.sqrt(1-f)/(1-f*Math.pow(b,2)),this.alpha=Math.sqrt(1+f/(1-f)*Math.pow(Math.cos(a),4)),this.b0=Math.asin(b/this.alpha);var h=Math.log(Math.tan(Math.PI/4+this.b0/2)),i=Math.log(Math.tan(Math.PI/4+a/2)),j=Math.log((1+g*b)/(1-g*b));this.K=h-this.alpha*i+this.alpha*g/2*j},c.forward=function(a){var b=Math.log(Math.tan(Math.PI/4-a.y/2)),c=this.e/2*Math.log((1+this.e*Math.sin(a.y))/(1-this.e*Math.sin(a.y))),d=-this.alpha*(b+c)+this.K,e=2*(Math.atan(Math.exp(d))-Math.PI/4),f=this.alpha*(a.x-this.lambda0),g=Math.atan(Math.sin(f)/(Math.sin(this.b0)*Math.tan(e)+Math.cos(this.b0)*Math.cos(f))),h=Math.asin(Math.cos(this.b0)*Math.sin(e)-Math.sin(this.b0)*Math.cos(e)*Math.cos(f));return a.y=this.R/2*Math.log((1+Math.sin(h))/(1-Math.sin(h)))+this.y0,a.x=this.R*g+this.x0,a},c.inverse=function(a){for(var b=a.x-this.x0,c=a.y-this.y0,d=b/this.R,e=2*(Math.atan(Math.exp(c/this.R))-Math.PI/4),f=Math.asin(Math.cos(this.b0)*Math.sin(e)+Math.sin(this.b0)*Math.cos(e)*Math.cos(d)),g=Math.atan(Math.sin(d)/(Math.cos(this.b0)*Math.cos(d)-Math.sin(this.b0)*Math.tan(e))),h=this.lambda0+g/this.alpha,i=0,j=f,k=-1e3,l=0;Math.abs(j-k)>1e-7;){if(++l>20)return;i=1/this.alpha*(Math.log(Math.tan(Math.PI/4+f/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(j))/2)),k=j,j=2*Math.atan(Math.exp(i))-Math.PI/2}return a.x=h,a.y=j,a},c.names=["somerc"]},{}],59:[function(a,b,c){var d=Math.PI/2,e=1e-10,f=a("../common/sign"),g=a("../common/msfnz"),h=a("../common/tsfnz"),i=a("../common/phi2z"),j=a("../common/adjust_lon");c.ssfn_=function(a,b,c){return b*=c,Math.tan(.5*(d+a))*Math.pow((1-b)/(1+b),.5*c)},c.init=function(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=e&&(this.k0=.5*(1+f(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=e&&(this.con=this.lat0>0?1:-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=e&&(this.k0=.5*this.cons*g(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/h(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=g(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-d,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},c.forward=function(a){var b,c,f,g,i,k,l=a.x,m=a.y,n=Math.sin(m),o=Math.cos(m),p=j(l-this.long0);return Math.abs(Math.abs(l-this.long0)-Math.PI)<=e&&Math.abs(m+this.lat0)<=e?(a.x=0/0,a.y=0/0,a):this.sphere?(b=2*this.k0/(1+this.sinlat0*n+this.coslat0*o*Math.cos(p)),a.x=this.a*b*o*Math.sin(p)+this.x0,a.y=this.a*b*(this.coslat0*n-this.sinlat0*o*Math.cos(p))+this.y0,a):(c=2*Math.atan(this.ssfn_(m,n,this.e))-d,g=Math.cos(c),f=Math.sin(c),Math.abs(this.coslat0)<=e?(i=h(this.e,m*this.con,this.con*n),k=2*this.a*this.k0*i/this.cons,a.x=this.x0+k*Math.sin(l-this.long0),a.y=this.y0-this.con*k*Math.cos(l-this.long0),a):(Math.abs(this.sinlat0)<e?(b=2*this.a*this.k0/(1+g*Math.cos(p)),a.y=b*f):(b=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*f+this.cosX0*g*Math.cos(p))),a.y=b*(this.cosX0*f-this.sinX0*g*Math.cos(p))+this.y0),a.x=b*g*Math.sin(p)+this.x0,a))},c.inverse=function(a){a.x-=this.x0,a.y-=this.y0;var b,c,f,g,h,k=Math.sqrt(a.x*a.x+a.y*a.y);if(this.sphere){var l=2*Math.atan(k/(.5*this.a*this.k0));return b=this.long0,c=this.lat0,e>=k?(a.x=b,a.y=c,a):(c=Math.asin(Math.cos(l)*this.sinlat0+a.y*Math.sin(l)*this.coslat0/k),b=j(Math.abs(this.coslat0)<e?this.lat0>0?this.long0+Math.atan2(a.x,-1*a.y):this.long0+Math.atan2(a.x,a.y):this.long0+Math.atan2(a.x*Math.sin(l),k*this.coslat0*Math.cos(l)-a.y*this.sinlat0*Math.sin(l))),a.x=b,a.y=c,a)}if(Math.abs(this.coslat0)<=e){if(e>=k)return c=this.lat0,b=this.long0,a.x=b,a.y=c,a;a.x*=this.con,a.y*=this.con,f=k*this.cons/(2*this.a*this.k0),c=this.con*i(this.e,f),b=this.con*j(this.con*this.long0+Math.atan2(a.x,-1*a.y))}else g=2*Math.atan(k*this.cosX0/(2*this.a*this.k0*this.ms1)),b=this.long0,e>=k?h=this.X0:(h=Math.asin(Math.cos(g)*this.sinX0+a.y*Math.sin(g)*this.cosX0/k),b=j(this.long0+Math.atan2(a.x*Math.sin(g),k*this.cosX0*Math.cos(g)-a.y*this.sinX0*Math.sin(g)))),c=-1*i(this.e,Math.tan(.5*(d+h)));return a.x=b,a.y=c,a},c.names=["stere"]},{"../common/adjust_lon":5,"../common/msfnz":15,"../common/phi2z":16,"../common/sign":21,"../common/tsfnz":24}],60:[function(a,b,c){var d=a("./gauss"),e=a("../common/adjust_lon");c.init=function(){d.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},c.forward=function(a){var b,c,f,g;return a.x=e(a.x-this.long0),d.forward.apply(this,[a]),b=Math.sin(a.y),c=Math.cos(a.y),f=Math.cos(a.x),g=this.k0*this.R2/(1+this.sinc0*b+this.cosc0*c*f),a.x=g*c*Math.sin(a.x),a.y=g*(this.cosc0*b-this.sinc0*c*f),a.x=this.a*a.x+this.x0,a.y=this.a*a.y+this.y0,a},c.inverse=function(a){var b,c,f,g,h;if(a.x=(a.x-this.x0)/this.a,a.y=(a.y-this.y0)/this.a,a.x/=this.k0,a.y/=this.k0,h=Math.sqrt(a.x*a.x+a.y*a.y)){var i=2*Math.atan2(h,this.R2);b=Math.sin(i),c=Math.cos(i),g=Math.asin(c*this.sinc0+a.y*b*this.cosc0/h),f=Math.atan2(a.x*b,h*this.cosc0*c-a.y*this.sinc0*b)}else g=this.phic0,f=0;return a.x=f,a.y=g,d.inverse.apply(this,[a]),a.x=e(a.x+this.long0),a},c.names=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative"]},{"../common/adjust_lon":5,"./gauss":45}],61:[function(a,b,c){var d=a("../common/e0fn"),e=a("../common/e1fn"),f=a("../common/e2fn"),g=a("../common/e3fn"),h=a("../common/mlfn"),i=a("../common/adjust_lon"),j=Math.PI/2,k=1e-10,l=a("../common/sign"),m=a("../common/asinz");c.init=function(){this.e0=d(this.es),this.e1=e(this.es),this.e2=f(this.es),this.e3=g(this.es),this.ml0=this.a*h(this.e0,this.e1,this.e2,this.e3,this.lat0)},c.forward=function(a){var b,c,d,e=a.x,f=a.y,g=i(e-this.long0),j=Math.sin(f),k=Math.cos(f);if(this.sphere){var l=k*Math.sin(g);if(Math.abs(Math.abs(l)-1)<1e-10)return 93;c=.5*this.a*this.k0*Math.log((1+l)/(1-l)),b=Math.acos(k*Math.cos(g)/Math.sqrt(1-l*l)),0>f&&(b=-b),d=this.a*this.k0*(b-this.lat0)}else{var m=k*g,n=Math.pow(m,2),o=this.ep2*Math.pow(k,2),p=Math.tan(f),q=Math.pow(p,2);b=1-this.es*Math.pow(j,2);var r=this.a/Math.sqrt(b),s=this.a*h(this.e0,this.e1,this.e2,this.e3,f);c=this.k0*r*m*(1+n/6*(1-q+o+n/20*(5-18*q+Math.pow(q,2)+72*o-58*this.ep2)))+this.x0,d=this.k0*(s-this.ml0+r*p*n*(.5+n/24*(5-q+9*o+4*Math.pow(o,2)+n/30*(61-58*q+Math.pow(q,2)+600*o-330*this.ep2))))+this.y0}return a.x=c,a.y=d,a},c.inverse=function(a){var b,c,d,e,f,g,h=6;if(this.sphere){var n=Math.exp(a.x/(this.a*this.k0)),o=.5*(n-1/n),p=this.lat0+a.y/(this.a*this.k0),q=Math.cos(p);b=Math.sqrt((1-q*q)/(1+o*o)),f=m(b),0>p&&(f=-f),g=0===o&&0===q?this.long0:i(Math.atan2(o,q)+this.long0)}else{var r=a.x-this.x0,s=a.y-this.y0;for(b=(this.ml0+s/this.k0)/this.a,c=b,e=0;!0&&(d=(b+this.e1*Math.sin(2*c)-this.e2*Math.sin(4*c)+this.e3*Math.sin(6*c))/this.e0-c,c+=d,!(Math.abs(d)<=k));e++)if(e>=h)return 95;if(Math.abs(c)<j){var t=Math.sin(c),u=Math.cos(c),v=Math.tan(c),w=this.ep2*Math.pow(u,2),x=Math.pow(w,2),y=Math.pow(v,2),z=Math.pow(y,2);b=1-this.es*Math.pow(t,2);var A=this.a/Math.sqrt(b),B=A*(1-this.es)/b,C=r/(A*this.k0),D=Math.pow(C,2);f=c-A*v*D/B*(.5-D/24*(5+3*y+10*w-4*x-9*this.ep2-D/30*(61+90*y+298*w+45*z-252*this.ep2-3*x))),g=i(this.long0+C*(1-D/6*(1+2*y+w-D/20*(5-2*w+28*y-3*x+8*this.ep2+24*z)))/u)}else f=j*l(s),g=this.long0}return a.x=g,a.y=f,a},c.names=["Transverse_Mercator","Transverse Mercator","tmerc"]},{"../common/adjust_lon":5,"../common/asinz":6,"../common/e0fn":7,"../common/e1fn":8,"../common/e2fn":9,"../common/e3fn":10,"../common/mlfn":14,"../common/sign":21}],62:[function(a,b,c){var d=.017453292519943295,e=a("./tmerc");c.dependsOn="tmerc",c.init=function(){this.zone&&(this.lat0=0,this.long0=(6*Math.abs(this.zone)-183)*d,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,e.init.apply(this),this.forward=e.forward,this.inverse=e.inverse)},c.names=["Universal Transverse Mercator System","utm"]},{"./tmerc":61}],63:[function(a,b,c){var d=a("../common/adjust_lon"),e=Math.PI/2,f=1e-10,g=a("../common/asinz");c.init=function(){this.R=this.a},c.forward=function(a){var b,c,h=a.x,i=a.y,j=d(h-this.long0);Math.abs(i)<=f&&(b=this.x0+this.R*j,c=this.y0);var k=g(2*Math.abs(i/Math.PI));(Math.abs(j)<=f||Math.abs(Math.abs(i)-e)<=f)&&(b=this.x0,c=i>=0?this.y0+Math.PI*this.R*Math.tan(.5*k):this.y0+Math.PI*this.R*-Math.tan(.5*k));var l=.5*Math.abs(Math.PI/j-j/Math.PI),m=l*l,n=Math.sin(k),o=Math.cos(k),p=o/(n+o-1),q=p*p,r=p*(2/n-1),s=r*r,t=Math.PI*this.R*(l*(p-s)+Math.sqrt(m*(p-s)*(p-s)-(s+m)*(q-s)))/(s+m);0>j&&(t=-t),b=this.x0+t;var u=m+p;return t=Math.PI*this.R*(r*u-l*Math.sqrt((s+m)*(m+1)-u*u))/(s+m),c=i>=0?this.y0+t:this.y0-t,a.x=b,a.y=c,a},c.inverse=function(a){var b,c,e,g,h,i,j,k,l,m,n,o,p;return a.x-=this.x0,a.y-=this.y0,n=Math.PI*this.R,e=a.x/n,g=a.y/n,h=e*e+g*g,i=-Math.abs(g)*(1+h),j=i-2*g*g+e*e,k=-2*i+1+2*g*g+h*h,p=g*g/k+(2*j*j*j/k/k/k-9*i*j/k/k)/27,l=(i-j*j/3/k)/k,m=2*Math.sqrt(-l/3),n=3*p/l/m,Math.abs(n)>1&&(n=n>=0?1:-1),o=Math.acos(n)/3,c=a.y>=0?(-m*Math.cos(o+Math.PI/3)-j/3/k)*Math.PI:-(-m*Math.cos(o+Math.PI/3)-j/3/k)*Math.PI,b=Math.abs(e)<f?this.long0:d(this.long0+Math.PI*(h-1+Math.sqrt(1+2*(e*e-g*g)+h*h))/2/e),a.x=b,a.y=c,a},c.names=["Van_der_Grinten_I","VanDerGrinten","vandg"]},{"../common/adjust_lon":5,"../common/asinz":6}],64:[function(a,b){var c=.017453292519943295,d=57.29577951308232,e=1,f=2,g=a("./datum_transform"),h=a("./adjust_axis"),i=a("./Proj"),j=a("./common/toPoint");b.exports=function k(a,b,l){function m(a,b){return(a.datum.datum_type===e||a.datum.datum_type===f)&&"WGS84"!==b.datumCode}var n;return Array.isArray(l)&&(l=j(l)),a.datum&&b.datum&&(m(a,b)||m(b,a))&&(n=new i("WGS84"),k(a,n,l),a=n),"enu"!==a.axis&&h(a,!1,l),"longlat"===a.projName?(l.x*=c,l.y*=c):(a.to_meter&&(l.x*=a.to_meter,l.y*=a.to_meter),a.inverse(l)),a.from_greenwich&&(l.x+=a.from_greenwich),l=g(a.datum,b.datum,l),b.from_greenwich&&(l.x-=b.from_greenwich),"longlat"===b.projName?(l.x*=d,l.y*=d):(b.forward(l),b.to_meter&&(l.x/=b.to_meter,l.y/=b.to_meter)),"enu"!==b.axis&&h(b,!0,l),l}},{"./Proj":2,"./adjust_axis":3,"./common/toPoint":23,"./datum_transform":30}],65:[function(a,b){function c(a,b,c){a[b]=c.map(function(a){var b={};return d(a,b),b}).reduce(function(a,b){return i(a,b)},{})}function d(a,b){var e;return Array.isArray(a)?(e=a.shift(),"PARAMETER"===e&&(e=a.shift()),1===a.length?Array.isArray(a[0])?(b[e]={},d(a[0],b[e])):b[e]=a[0]:a.length?"TOWGS84"===e?b[e]=a:(b[e]={},["UNIT","PRIMEM","VERT_DATUM"].indexOf(e)>-1?(b[e]={name:a[0].toLowerCase(),convert:a[1]},3===a.length&&(b[e].auth=a[2])):"SPHEROID"===e?(b[e]={name:a[0],a:a[1],rf:a[2]},4===a.length&&(b[e].auth=a[3])):["GEOGCS","GEOCCS","DATUM","VERT_CS","COMPD_CS","LOCAL_CS","FITTED_CS","LOCAL_DATUM"].indexOf(e)>-1?(a[0]=["name",a[0]],c(b,e,a)):a.every(function(a){return Array.isArray(a)})?c(b,e,a):d(a,b[e])):b[e]=!0,void 0):void(b[a]=!0)}function e(a,b){var c=b[0],d=b[1];!(c in a)&&d in a&&(a[c]=a[d],3===b.length&&(a[c]=b[2](a[c])))}function f(a){return a*h}function g(a){function b(b){var c=a.to_meter||1;return parseFloat(b,10)*c}"GEOGCS"===a.type?a.projName="longlat":"LOCAL_CS"===a.type?(a.projName="identity",a.local=!0):a.projName="object"==typeof a.PROJECTION?Object.keys(a.PROJECTION)[0]:a.PROJECTION,a.UNIT&&(a.units=a.UNIT.name.toLowerCase(),"metre"===a.units&&(a.units="meter"),a.UNIT.convert&&(a.to_meter=parseFloat(a.UNIT.convert,10))),a.GEOGCS&&(a.datumCode=a.GEOGCS.DATUM?a.GEOGCS.DATUM.name.toLowerCase():a.GEOGCS.name.toLowerCase(),"d_"===a.datumCode.slice(0,2)&&(a.datumCode=a.datumCode.slice(2)),("new_zealand_geodetic_datum_1949"===a.datumCode||"new_zealand_1949"===a.datumCode)&&(a.datumCode="nzgd49"),"wgs_1984"===a.datumCode&&("Mercator_Auxiliary_Sphere"===a.PROJECTION&&(a.sphere=!0),a.datumCode="wgs84"),"_ferro"===a.datumCode.slice(-6)&&(a.datumCode=a.datumCode.slice(0,-6)),"_jakarta"===a.datumCode.slice(-8)&&(a.datumCode=a.datumCode.slice(0,-8)),~a.datumCode.indexOf("belge")&&(a.datumCode="rnb72"),a.GEOGCS.DATUM&&a.GEOGCS.DATUM.SPHEROID&&(a.ellps=a.GEOGCS.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===a.ellps.toLowerCase().slice(0,13)&&(a.ellps="intl"),a.a=a.GEOGCS.DATUM.SPHEROID.a,a.rf=parseFloat(a.GEOGCS.DATUM.SPHEROID.rf,10)),~a.datumCode.indexOf("osgb_1936")&&(a.datumCode="osgb36")),a.b&&!isFinite(a.b)&&(a.b=a.a);
+var c=function(b){return e(a,b)},d=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_2","Standard_Parallel_2"],["false_easting","False_Easting"],["false_northing","False_Northing"],["central_meridian","Central_Meridian"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",f],["longitude_of_center","Longitude_Of_Center"],["longc","longitude_of_center",f],["x0","false_easting",b],["y0","false_northing",b],["long0","central_meridian",f],["lat0","latitude_of_origin",f],["lat0","standard_parallel_1",f],["lat1","standard_parallel_1",f],["lat2","standard_parallel_2",f],["alpha","azimuth",f],["srsCode","name"]];d.forEach(c),a.long0||!a.longc||"Albers_Conic_Equal_Area"!==a.PROJECTION&&"Lambert_Azimuthal_Equal_Area"!==a.PROJECTION||(a.long0=a.longc)}var h=.017453292519943295,i=a("./extend");b.exports=function(a,b){var c=JSON.parse((","+a).replace(/\s*\,\s*([A-Z_0-9]+?)(\[)/g,',["$1",').slice(1).replace(/\s*\,\s*([A-Z_0-9]+?)\]/g,',"$1"]').replace(/,\["VERTCS".+/,"")),e=c.shift(),f=c.shift();c.unshift(["name",f]),c.unshift(["type",e]),c.unshift("output");var h={};return d(c,h),g(h.output),i(b,h.output)}},{"./extend":33}],66:[function(a,b,c){function d(a){return a*(Math.PI/180)}function e(a){return 180*(a/Math.PI)}function f(a){var b,c,e,f,g,i,j,k,l,m=a.lat,n=a.lon,o=6378137,p=.00669438,q=.9996,r=d(m),s=d(n);l=Math.floor((n+180)/6)+1,180===n&&(l=60),m>=56&&64>m&&n>=3&&12>n&&(l=32),m>=72&&84>m&&(n>=0&&9>n?l=31:n>=9&&21>n?l=33:n>=21&&33>n?l=35:n>=33&&42>n&&(l=37)),b=6*(l-1)-180+3,k=d(b),c=p/(1-p),e=o/Math.sqrt(1-p*Math.sin(r)*Math.sin(r)),f=Math.tan(r)*Math.tan(r),g=c*Math.cos(r)*Math.cos(r),i=Math.cos(r)*(s-k),j=o*((1-p/4-3*p*p/64-5*p*p*p/256)*r-(3*p/8+3*p*p/32+45*p*p*p/1024)*Math.sin(2*r)+(15*p*p/256+45*p*p*p/1024)*Math.sin(4*r)-35*p*p*p/3072*Math.sin(6*r));var t=q*e*(i+(1-f+g)*i*i*i/6+(5-18*f+f*f+72*g-58*c)*i*i*i*i*i/120)+5e5,u=q*(j+e*Math.tan(r)*(i*i/2+(5-f+9*g+4*g*g)*i*i*i*i/24+(61-58*f+f*f+600*g-330*c)*i*i*i*i*i*i/720));return 0>m&&(u+=1e7),{northing:Math.round(u),easting:Math.round(t),zoneNumber:l,zoneLetter:h(m)}}function g(a){var b=a.northing,c=a.easting,d=a.zoneLetter,f=a.zoneNumber;if(0>f||f>60)return null;var h,i,j,k,l,m,n,o,p,q,r=.9996,s=6378137,t=.00669438,u=(1-Math.sqrt(1-t))/(1+Math.sqrt(1-t)),v=c-5e5,w=b;"N">d&&(w-=1e7),o=6*(f-1)-180+3,h=t/(1-t),n=w/r,p=n/(s*(1-t/4-3*t*t/64-5*t*t*t/256)),q=p+(3*u/2-27*u*u*u/32)*Math.sin(2*p)+(21*u*u/16-55*u*u*u*u/32)*Math.sin(4*p)+151*u*u*u/96*Math.sin(6*p),i=s/Math.sqrt(1-t*Math.sin(q)*Math.sin(q)),j=Math.tan(q)*Math.tan(q),k=h*Math.cos(q)*Math.cos(q),l=s*(1-t)/Math.pow(1-t*Math.sin(q)*Math.sin(q),1.5),m=v/(i*r);var x=q-i*Math.tan(q)/l*(m*m/2-(5+3*j+10*k-4*k*k-9*h)*m*m*m*m/24+(61+90*j+298*k+45*j*j-252*h-3*k*k)*m*m*m*m*m*m/720);x=e(x);var y=(m-(1+2*j+k)*m*m*m/6+(5-2*k+28*j-3*k*k+8*h+24*j*j)*m*m*m*m*m/120)/Math.cos(q);y=o+e(y);var z;if(a.accuracy){var A=g({northing:a.northing+a.accuracy,easting:a.easting+a.accuracy,zoneLetter:a.zoneLetter,zoneNumber:a.zoneNumber});z={top:A.lat,right:A.lon,bottom:x,left:y}}else z={lat:x,lon:y};return z}function h(a){var b="Z";return 84>=a&&a>=72?b="X":72>a&&a>=64?b="W":64>a&&a>=56?b="V":56>a&&a>=48?b="U":48>a&&a>=40?b="T":40>a&&a>=32?b="S":32>a&&a>=24?b="R":24>a&&a>=16?b="Q":16>a&&a>=8?b="P":8>a&&a>=0?b="N":0>a&&a>=-8?b="M":-8>a&&a>=-16?b="L":-16>a&&a>=-24?b="K":-24>a&&a>=-32?b="J":-32>a&&a>=-40?b="H":-40>a&&a>=-48?b="G":-48>a&&a>=-56?b="F":-56>a&&a>=-64?b="E":-64>a&&a>=-72?b="D":-72>a&&a>=-80&&(b="C"),b}function i(a,b){var c=""+a.easting,d=""+a.northing;return a.zoneNumber+a.zoneLetter+j(a.easting,a.northing,a.zoneNumber)+c.substr(c.length-5,b)+d.substr(d.length-5,b)}function j(a,b,c){var d=k(c),e=Math.floor(a/1e5),f=Math.floor(b/1e5)%20;return l(e,f,d)}function k(a){var b=a%q;return 0===b&&(b=q),b}function l(a,b,c){var d=c-1,e=r.charCodeAt(d),f=s.charCodeAt(d),g=e+a-1,h=f+b,i=!1;g>x&&(g=g-x+t-1,i=!0),(g===u||u>e&&g>u||(g>u||u>e)&&i)&&g++,(g===v||v>e&&g>v||(g>v||v>e)&&i)&&(g++,g===u&&g++),g>x&&(g=g-x+t-1),h>w?(h=h-w+t-1,i=!0):i=!1,(h===u||u>f&&h>u||(h>u||u>f)&&i)&&h++,(h===v||v>f&&h>v||(h>v||v>f)&&i)&&(h++,h===u&&h++),h>w&&(h=h-w+t-1);var j=String.fromCharCode(g)+String.fromCharCode(h);return j}function m(a){if(a&&0===a.length)throw"MGRSPoint coverting from nothing";for(var b,c=a.length,d=null,e="",f=0;!/[A-Z]/.test(b=a.charAt(f));){if(f>=2)throw"MGRSPoint bad conversion from: "+a;e+=b,f++}var g=parseInt(e,10);if(0===f||f+3>c)throw"MGRSPoint bad conversion from: "+a;var h=a.charAt(f++);if("A">=h||"B"===h||"Y"===h||h>="Z"||"I"===h||"O"===h)throw"MGRSPoint zone letter "+h+" not handled: "+a;d=a.substring(f,f+=2);for(var i=k(g),j=n(d.charAt(0),i),l=o(d.charAt(1),i);l<p(h);)l+=2e6;var m=c-f;if(m%2!==0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+a;var q,r,s,t,u,v=m/2,w=0,x=0;return v>0&&(q=1e5/Math.pow(10,v),r=a.substring(f,f+v),w=parseFloat(r)*q,s=a.substring(f+v),x=parseFloat(s)*q),t=w+j,u=x+l,{easting:t,northing:u,zoneLetter:h,zoneNumber:g,accuracy:q}}function n(a,b){for(var c=r.charCodeAt(b-1),d=1e5,e=!1;c!==a.charCodeAt(0);){if(c++,c===u&&c++,c===v&&c++,c>x){if(e)throw"Bad character: "+a;c=t,e=!0}d+=1e5}return d}function o(a,b){if(a>"V")throw"MGRSPoint given invalid Northing "+a;for(var c=s.charCodeAt(b-1),d=0,e=!1;c!==a.charCodeAt(0);){if(c++,c===u&&c++,c===v&&c++,c>w){if(e)throw"Bad character: "+a;c=t,e=!0}d+=1e5}return d}function p(a){var b;switch(a){case"C":b=11e5;break;case"D":b=2e6;break;case"E":b=28e5;break;case"F":b=37e5;break;case"G":b=46e5;break;case"H":b=55e5;break;case"J":b=64e5;break;case"K":b=73e5;break;case"L":b=82e5;break;case"M":b=91e5;break;case"N":b=0;break;case"P":b=8e5;break;case"Q":b=17e5;break;case"R":b=26e5;break;case"S":b=35e5;break;case"T":b=44e5;break;case"U":b=53e5;break;case"V":b=62e5;break;case"W":b=7e6;break;case"X":b=79e5;break;default:b=-1}if(b>=0)return b;throw"Invalid zone letter: "+a}var q=6,r="AJSAJS",s="AFAFAF",t=65,u=73,v=79,w=86,x=90;c.forward=function(a,b){return b=b||5,i(f({lat:a[1],lon:a[0]}),b)},c.inverse=function(a){var b=g(m(a.toUpperCase()));return[b.left,b.bottom,b.right,b.top]},c.toPoint=function(a){var b=c.inverse(a);return[(b[2]+b[0])/2,(b[3]+b[1])/2]}},{}],67:[function(a,b){b.exports={name:"proj4",version:"2.3.3",description:"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",main:"lib/index.js",directories:{test:"test",doc:"docs"},scripts:{test:"./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"},repository:{type:"git",url:"git://github.com/proj4js/proj4js.git"},author:"",license:"MIT",jam:{main:"dist/proj4.js",include:["dist/proj4.js","README.md","AUTHORS","LICENSE.md"]},devDependencies:{"grunt-cli":"~0.1.13",grunt:"~0.4.2","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~0.8.0",chai:"~1.8.1",mocha:"~1.17.1","grunt-mocha-phantomjs":"~0.4.0",browserify:"~3.24.5","grunt-browserify":"~1.3.0","grunt-contrib-uglify":"~0.3.2",curl:"git://github.com/cujojs/curl.git",istanbul:"~0.2.4",tin:"~0.4.0"},dependencies:{mgrs:"0.0.0"}}},{}],"./includedProjections":[function(a,b){b.exports=a("gWUPNW")},{}],gWUPNW:[function(a,b){var c=[a("./lib/projections/tmerc"),a("./lib/projections/utm"),a("./lib/projections/sterea"),a("./lib/projections/stere"),a("./lib/projections/somerc"),a("./lib/projections/omerc"),a("./lib/projections/lcc"),a("./lib/projections/krovak"),a("./lib/projections/cass"),a("./lib/projections/laea"),a("./lib/projections/aea"),a("./lib/projections/gnom"),a("./lib/projections/cea"),a("./lib/projections/eqc"),a("./lib/projections/poly"),a("./lib/projections/nzmg"),a("./lib/projections/mill"),a("./lib/projections/sinu"),a("./lib/projections/moll"),a("./lib/projections/eqdc"),a("./lib/projections/vandg"),a("./lib/projections/aeqd")];b.exports=function(proj4){c.forEach(function(a){proj4.Proj.projections.add(a)})}},{"./lib/projections/aea":39,"./lib/projections/aeqd":40,"./lib/projections/cass":41,"./lib/projections/cea":42,"./lib/projections/eqc":43,"./lib/projections/eqdc":44,"./lib/projections/gnom":46,"./lib/projections/krovak":47,"./lib/projections/laea":48,"./lib/projections/lcc":49,"./lib/projections/mill":52,"./lib/projections/moll":53,"./lib/projections/nzmg":54,"./lib/projections/omerc":55,"./lib/projections/poly":56,"./lib/projections/sinu":57,"./lib/projections/somerc":58,"./lib/projections/stere":59,"./lib/projections/sterea":60,"./lib/projections/tmerc":61,"./lib/projections/utm":62,"./lib/projections/vandg":63}]},{},[35])(35)});
\ No newline at end of file
diff --git a/web/index.html b/web/index.html
index d4f8ca54f..ad515a0b6 100644
--- a/web/index.html
+++ b/web/index.html
@@ -128,8 +128,7 @@
<!-- link.dev --> <script type="text/javascript" src="ext/tour/joyride-2.0.3-3/joyride.js"></script>
<!-- link.prod --> <!-- <script type="text/javascript" src="ext/tour/joyride-2.0.3-3/joyride.min.js"></script> -->
- <!-- link.dev --> <script type="text/javascript" src="ext/proj/proj4js-1.1.0-1/proj4js.js"></script>
- <!-- link.prod --> <!-- <script type="text/javascript" src="ext/proj/proj4js-1.1.0-1/proj4js.min.js"></script> -->
+ <script type="text/javascript" src="ext/proj/proj4js-2.3.3-1/proj4.js"></script>
<!-- link.dev --> <script type="text/javascript" src="ext/image/jcrop-0.9.10-p1/jcrop.js"></script>
<!-- link.prod --> <!-- <script type="text/javascript" src="ext/image/jcrop-0.9.10-p1/jcrop.min.js"></script> -->
diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.js
index 93417141f..fff81c5fd 100644
--- a/web/js/map/wv.map.ui.js
+++ b/web/js/map/wv.map.ui.js
@@ -114,7 +114,6 @@ wv.map.ui = wv.map.ui || function(models, config) {
};
var addLayer = function(def) {
- console.log("add");
var mapIndex = _.findIndex(models.layers.get({reverse: true}), {
id: def.id
});
@@ -128,7 +127,6 @@ wv.map.ui = wv.map.ui || function(models, config) {
};
var removeLayer = function(def) {
- console.log("remove");
if ( isGraticule(def) ) {
removeGraticule();
} else {
@@ -310,6 +308,18 @@ wv.map.ui = wv.map.ui || function(models, config) {
className: "wv-map-scale-imperial",
units: "imperial"
});
+ var coordinateFormat = function(source) {
+ var target = ol.proj.transform(source, proj.crs, "EPSG:4326");
+ var crs = ( models.proj.change ) ? models.proj.change.crs
+ : models.proj.selected.crs;
+ var str = wv.util.formatDMS(target[1], "latitude") + ", " +
+ wv.util.formatDMS(target[0], "longitude") + " " +
+ crs;
+ return str;
+ };
+ var mousePosition = new ol.control.MousePosition({
+ coordinateFormat: coordinateFormat
+ });
var map = new ol.Map({
view: new ol.View({
@@ -325,7 +335,8 @@ wv.map.ui = wv.map.ui || function(models, config) {
logo: false,
controls: [
scaleMetric,
- scaleImperial
+ scaleImperial,
+ mousePosition
]
});
createZoomButtons(map);
diff --git a/web/js/proj/wv.proj.model.js b/web/js/proj/wv.proj.model.js
index 729500b2a..be769dad5 100644
--- a/web/js/proj/wv.proj.model.js
+++ b/web/js/proj/wv.proj.model.js
@@ -27,7 +27,10 @@ wv.proj.model = wv.proj.model || function(config) {
var init = function() {
self.selectDefault();
_.each(config.projections, function(proj) {
- self.register(proj.crs, proj.proj4);
+ if ( proj.crs && proj.proj4 ) {
+ self.register(proj.crs, proj.proj4);
+ ol.proj.get(proj.crs).setExtent(proj.maxExtent);
+ }
});
};
@@ -62,8 +65,8 @@ wv.proj.model = wv.proj.model || function(config) {
};
self.register = function(crs, def) {
- if ( def && window.Proj4js && !Proj4js.defs[crs] ) {
- Proj4js.defs[crs] = def;
+ if ( def && window.proj4 ) {
+ proj4.defs(crs, def);
}
};