├── .gitignore ├── .jshintrc ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── bin ├── mcs2cs └── mproj ├── build ├── dist └── .gitignore ├── nad ├── CH ├── GL27 ├── IGNF ├── epsg ├── epsg-deprecated ├── esri ├── esri.extra ├── nad27 ├── nad83 ├── other.extra └── world ├── package.json ├── src ├── aasincos.js ├── adjlon.js ├── cli │ ├── cli_lib.js │ └── parse_args.js ├── dmstor.js ├── geodesic.js ├── nad_cvt.js ├── pj_apply_gridshift.js ├── pj_auth.js ├── pj_const.js ├── pj_ctx.js ├── pj_datum_set.js ├── pj_datums.js ├── pj_ell_set.js ├── pj_ellps.js ├── pj_err.js ├── pj_fwd.js ├── pj_gauss.js ├── pj_geocent.js ├── pj_init.js ├── pj_initcache.js ├── pj_inv.js ├── pj_list.js ├── pj_mlfn.js ├── pj_msfn.js ├── pj_open_lib.js ├── pj_param.js ├── pj_phi2.js ├── pj_qsfn.js ├── pj_strerrno.js ├── pj_strtod.js ├── pj_transform.js ├── pj_tsfn.js ├── pj_units.js ├── pj_utils.js ├── pj_zpoly1.js ├── proj-minimal.js ├── proj.js ├── proj4js_compat.js ├── projections │ ├── aea.js │ ├── aeqd.js │ ├── airy.js │ ├── aitoff.js │ ├── august.js │ ├── bacon.js │ ├── bertin1953.js │ ├── boggs.js │ ├── bonne.js │ ├── cass.js │ ├── cea.js │ ├── chamb.js │ ├── crast.js │ ├── cupola.js │ ├── denoy.js │ ├── eck.js │ ├── eqc.js │ ├── eqdc.js │ ├── eqearth.js │ ├── etmerc.js │ ├── gall.js │ ├── geocent.js │ ├── geos.js │ ├── gilbert.js │ ├── gins8.js │ ├── gn_sinu.js │ ├── gnom.js │ ├── goode.js │ ├── hammer.js │ ├── hatano.js │ ├── healpix.js │ ├── hill.js │ ├── krovak.js │ ├── laea.js │ ├── latlong.js │ ├── lcc.js │ ├── loxim.js │ ├── mbt_fpp.js │ ├── mbt_fpq.js │ ├── mbt_fps.js │ ├── merc.js │ ├── mill.js │ ├── mod_ster.js │ ├── moll.js │ ├── natearth.js │ ├── nell.js │ ├── nell_h.js │ ├── nsper.js │ ├── nzmg.js │ ├── ob_tran.js │ ├── ocea.js │ ├── omerc.js │ ├── ortho.js │ ├── patterson.js │ ├── poly.js │ ├── putp2.js │ ├── putp3.js │ ├── putp4p.js │ ├── putp5.js │ ├── putp6.js │ ├── qsc.js │ ├── robin.js │ ├── sconics.js │ ├── somerc.js │ ├── stere.js │ ├── sterea.js │ ├── sts.js │ ├── tcea.js │ ├── times.js │ ├── tmerc.js │ ├── tpeqd.js │ ├── urm5.js │ ├── urmfps.js │ ├── vandg.js │ ├── wag.js │ └── wink.js ├── rtodms.js └── wkt │ ├── projections │ ├── wkt_krovak.js │ ├── wkt_lcc.js │ ├── wkt_merc.js │ ├── wkt_omerc.js │ ├── wkt_simple_projections.js │ ├── wkt_stere.js │ ├── wkt_utm.js │ └── wkt_vandg.js │ ├── wkt.js │ ├── wkt_add.js │ ├── wkt_axis.js │ ├── wkt_common.js │ ├── wkt_convert_geogcs.js │ ├── wkt_convert_projcs.js │ ├── wkt_fallback.js │ ├── wkt_make_geogcs.js │ ├── wkt_make_projcs.js │ ├── wkt_parameters.js │ ├── wkt_parse.js │ ├── wkt_stringify.js │ └── wkt_unit.js └── test ├── api_test.js ├── cli_lib_test.js ├── debug_test.js ├── dmstor_test.js ├── gigs ├── 5101.1-jhs.json ├── 5101.2-jhs.json ├── 5101.3-jhs.json ├── 5101.4-jhs-etmerc.json ├── 5101.4-jhs.json ├── 5102.1.json ├── 5102.2.json ├── 5103.1.json ├── 5103.2.json ├── 5103.3.json ├── 5104.json ├── 5105.1.json ├── 5105.2.json ├── 5106.json ├── 5107.json ├── 5108.json ├── 5109.json ├── 5110.json ├── 5111.1.json ├── 5111.2.json ├── 5112.json ├── 5113.json ├── 5201.json ├── 5203.1.json ├── 5204.1.json ├── 5205.1.json ├── 5206.json ├── 5207.1.json ├── 5207.2.json ├── 5208.json ├── TESTNOTES.md └── test.js ├── github_issues_test.js ├── helpers.js ├── issue_fallback_wkt.js ├── mcs2cs_test.js ├── mproj_test.js ├── pj_add_test.js ├── pj_datums_test.js ├── pj_init_test.js ├── pj_read_opts_test.js ├── pj_utils_test.js ├── ported_self_tests ├── aea_test.js ├── aeqd_test.js ├── airy_test.js ├── aitoff_test.js ├── august_test.js ├── bacon_test.js ├── boggs_test.js ├── bonne_test.js ├── cass_test.js ├── cea_test.js ├── chamb_test.js ├── crast_test.js ├── denoy_test.js ├── eck_test.js ├── eqc_test.js ├── eqdc_test.js ├── etmerc_test.js ├── gall_test.js ├── gins8_test.js ├── gn_sinu_test.js ├── gnom_test.js ├── goode_test.js ├── hammer_test.js ├── hatano_test.js ├── healpix_test.js ├── krovak_test.js ├── laea_test.js ├── lcc_test.js ├── loxim_test.js ├── mbt_fpx_test.js ├── merc_test.js ├── mill_test.js ├── mod_ster_test.js ├── moll_test.js ├── natearth_test.js ├── nell_h_test.js ├── nell_test.js ├── nsper_test.js ├── nzmg_test.js ├── ob_tran_test.js ├── ocea_test.js ├── omerc_test.js ├── ortho_test.js ├── poly_test.js ├── putp2_test.js ├── putp3_test.js ├── putp4p_test.js ├── putp5_test.js ├── putp6_test.js ├── qsc_test.js ├── robin_test.js ├── sconics_test.js ├── sn_sinu_test.js ├── somerc_test.js ├── stere_test.js ├── sterea_test.js ├── sts_test.js ├── tmerc_test.js ├── tpeqd_test.js ├── urm5_test.js ├── urmfps_test.js ├── vandg_test.js ├── wag_test.js └── wink_test.js ├── prj ├── albers_australia_esri.prj ├── albers_australia_ogc.prj ├── azimuthal_equidistant_esri.prj ├── azimuthal_equidistant_ogc.prj ├── bc_albers_esri.prj ├── bc_albers_ogc.prj ├── british_national_grid_esri.prj ├── british_national_grid_ogc.prj ├── cassini_esri.prj ├── cassini_ogc.prj ├── eqdc_esri.prj ├── eqdc_ogc.prj ├── eqdc_south_america_esri.prj ├── equirectangular_sphere_esri.prj ├── equirectangular_sphere_ogc.prj ├── etrs89_austria_esri.prj ├── etrs89_austria_ogc.prj ├── g33_dotacional_educacion_escuelas.prj ├── geocentric_esri.prj ├── geocentric_ogc.prj ├── issues │ ├── Anmarkningar.prj │ ├── MontVa_Supervisor_Precincts.prj │ ├── Town_Majia_Sanhe.prj │ ├── papua_new_guinea.prj │ └── qgis_eqearth.prj ├── krovak_esri.prj ├── krovak_ogc.prj ├── laea_esri.prj ├── laea_ogc.prj ├── lcc_1sp_esri.prj ├── lcc_1sp_ogc.prj ├── lcc_oregon_esri.prj ├── lcc_oregon_ogc.prj ├── mercator_1sp_esri.prj ├── mercator_1sp_ogc.prj ├── mollweide_world_esri.prj ├── mollweide_world_ogc.prj ├── nsper_world_esri.prj ├── nzgd_esri.prj ├── nzgd_ogc.prj ├── omerc_alaska_esri.prj ├── omerc_alaska_ogc.prj ├── omerc_kertau_esri.prj ├── omerc_kertau_ogc.prj ├── omerc_michigan_esri.prj ├── omerc_michigan_ogc.prj ├── omerc_michigan_v2_esri.prj ├── omerc_michigan_v2_ogc.prj ├── omerc_world_esri.prj ├── omerc_world_ogc.prj ├── plate_carree_sphere_esri.prj ├── plate_carree_sphere_ogc.prj ├── prince_edward_island_stereographic_esri.prj ├── prince_edward_island_stereographic_ogc.prj ├── robinson_sphere_esri.prj ├── robinson_world_esri.prj ├── stateplane_ny_li_nad83_feet_esri.prj ├── stateplane_ny_li_nad83_feet_ogc.prj ├── tmerc_epsg2393_esri.prj ├── tmerc_epsg2393_ogc.prj ├── tmerc_wuhan_ejdl.prj ├── ups_south_esri.prj ├── ups_south_ogc.prj ├── utm_18N_csrs98_esri.prj ├── utm_18N_csrs98_ogc.prj ├── utm_18N_esri.prj ├── utm_18N_ogc.prj ├── vandg_world_esri.prj ├── vandg_world_ogc.prj ├── web_mercator_aux_sphere_esri.prj ├── web_mercator_esri.prj ├── web_mercator_v2_esri.prj ├── web_mercator_v2_ogc.prj ├── web_mercator_v3_esri.prj ├── web_mercator_v3_ogc.prj ├── web_mercator_v4.prj ├── wgs84_esri.prj ├── wgs84_ogc.prj ├── wintri_esri.prj ├── wintri_ogc.prj ├── world_sinusoidal_esri.prj └── world_sinusoidal_ogc.prj ├── proj4_to_wkt_test.js ├── proj4js_test.js ├── projections ├── geos_test.js └── webmerc_test.js ├── rtodms_test.js ├── various_test.js ├── wkt_geogcs_test.js ├── wkt_parse_issues.js ├── wkt_parse_test.js ├── wkt_projcs_test.js ├── wkt_stringify_test.js ├── wkt_test.js └── wkt_to_proj4_test.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | __* 3 | node_modules 4 | .npmignore 5 | .jshintrc 6 | release* 7 | dist/*.js 8 | package-lock.json -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "boss": true, 3 | "eqnull": true, 4 | "-W041": false 5 | } -------------------------------------------------------------------------------- /dist/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbloch/mapshaper-proj/70b7ed193440208e4399032e539d2295bd68fb60/dist/.gitignore -------------------------------------------------------------------------------- /nad/CH: -------------------------------------------------------------------------------- 1 | # This init file provides definitions for CH1903 and CH1903/LV03 2 | # projections using the distortion grids developed by Swisstopo. 3 | # See: http://www.swisstopo.admin.ch/internet/swisstopo/en/home/topics/survey/lv03-lv95/chenyx06/distortion_grids.html 4 | # 5 | # You'll need to download the grids separately and put in a directory 6 | # scanned by libproj. Directories may be added to the scan list through 7 | # the PROJ_LIB environment variable 8 | # 9 | # Note that an independent effort was made to derive an usable grid 10 | # from the CH1903->CH1903+ grid initially available from the Swisstopo 11 | # website. You can read about this other effort here: 12 | # http://lists.maptools.org/pipermail/proj/2012-February/006093.html 13 | # It may be of interest because the latter was by some reported as being 14 | # more accurate than the former: 15 | # http://lists.maptools.org/pipermail/proj/2012-February/006119.html 16 | # 17 | # This init file uses the official one 18 | # 19 | # CH1903/LV03 20 | <1903_LV03> +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +units=m +nadgrids=chenyx06etrs.gsb +no_defs 21 | # CH1903 22 | <1903> +proj=longlat +ellps=bessel +nadgrids=chenyx06etrs.gsb +no_defs <> 23 | -------------------------------------------------------------------------------- /nad/GL27: -------------------------------------------------------------------------------- 1 | # SCCSID @(#)GL27 1.1 93/08/25 GIE REL 2 | # Great Lakes Grids 3 | # Lake Erie, Ontario and St. Lawrence River. 4 | proj=omerc ellps=clrk66 k_0=0.9999 5 | lonc=78d00'W lat_0=44d00'N alpha=55d40' 6 | x_0=-3950000 y_0=-3430000 7 | no_defs <> 8 | # Lake Huron 9 | proj=omerc ellps=clrk66 k_0=0.9999 10 | lonc=82d00'W lat_0=43d00'N alpha=350d37' 11 | x_0=1200000 y_0=-3500000 12 | no_defs <> 13 | # Lake Michigan 14 | proj=omerc ellps=clrk66 k_0=0.9999 15 | lonc=87d00'W lat_0=44d00'N alpha=15d00' 16 | x_0=-1000000 y_0=-4300000 17 | no_defs <> 18 | # Lake Superior, Lake of the Woods 19 | proj=omerc ellps=clrk66 k_0=0.9999 20 | lonc=88d50'0.256"W lat_0=47d12'21.554"N alpha=285d41'42.593" 21 | x_0=9000000 y_0=-1600000 22 | no_defs <> 23 | -------------------------------------------------------------------------------- /nad/epsg-deprecated: -------------------------------------------------------------------------------- 1 | # DHDN / Germany zone 3 2 | <31493> +proj=tmerc +lat_0=0.000000000 +lon_0=9.000000000 +k=1.000000 +x_0=3500000.000 +y_0=0.000 +ellps=bessel +units=m no_defs <> 3 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mproj", 3 | "version": "0.0.40", 4 | "description": "A JavaScript port of the Proj.4 cartographic projections library", 5 | "keywords": [ 6 | "projections", 7 | "proj4", 8 | "cartography" 9 | ], 10 | "author": "Matthew Bloch ", 11 | "license": "MIT", 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/mbloch/mapshaper-proj" 15 | }, 16 | "engines": { 17 | "node": ">=0.12.0" 18 | }, 19 | "scripts": { 20 | "test": "mocha --recursive --check-leaks -R dot", 21 | "dev": "node build -f", 22 | "pretest": "node build", 23 | "prepublish": "npm test", 24 | "postpublish": "node ../mapshaper-extra/release.js mapshaper-proj" 25 | }, 26 | "main": "./dist/mproj.js", 27 | "files": [ 28 | "bin/**", 29 | "nad/**", 30 | "dist/**" 31 | ], 32 | "dependencies": { 33 | "rw": "~1.3.2", 34 | "geographiclib": "1.48.0" 35 | }, 36 | "devDependencies": { 37 | "catty": "0.0.8", 38 | "mocha": "^6.2.1", 39 | "proj4": "~2.3.14", 40 | "underscore": "~1.7" 41 | }, 42 | "bin": { 43 | "mproj": "./bin/mproj", 44 | "mcs2cs": "./bin/mcs2cs" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/aasincos.js: -------------------------------------------------------------------------------- 1 | 2 | function aasin(v) { 3 | var ONE_TOL = 1.00000000000001; 4 | var av = fabs(v); 5 | if (av >= 1) { 6 | if (av > ONE_TOL) pj_ctx_set_errno(-19); 7 | return v < 0 ? -M_HALFPI : M_HALFPI; 8 | } 9 | return asin(v); 10 | } 11 | 12 | function aacos(v) { 13 | var ONE_TOL = 1.00000000000001; 14 | var av = fabs(v); 15 | if (av >= 1) { 16 | if (av > ONE_TOL) pj_ctx_set_errno(-19); 17 | return (v < 0 ? M_PI : 0); 18 | } 19 | return acos(v); 20 | } 21 | 22 | function asqrt(v) { return ((v <= 0) ? 0 : sqrt(v)); } 23 | 24 | function aatan2(n, d) { 25 | var ATOL = 1e-50; 26 | return ((fabs(n) < ATOL && fabs(d) < ATOL) ? 0 : atan2(n,d)); 27 | } 28 | -------------------------------------------------------------------------------- /src/adjlon.js: -------------------------------------------------------------------------------- 1 | function adjlon(lon) { 2 | var SPI = 3.14159265359, 3 | TWOPI = 6.2831853071795864769, 4 | ONEPI = 3.14159265358979323846; 5 | 6 | if (fabs(lon) > SPI) { 7 | lon += ONEPI; /* adjust to 0.0.2pi rad */ 8 | lon -= TWOPI * floor(lon / TWOPI); /* remove integral # of 'revolutions'*/ 9 | lon -= ONEPI; /* adjust back to -pi..pi rad */ 10 | } 11 | return lon; 12 | } 13 | -------------------------------------------------------------------------------- /src/dmstor.js: -------------------------------------------------------------------------------- 1 | /* @requires pj_err */ 2 | 3 | function dmstor(str) { 4 | return dmstod(str) * DEG_TO_RAD; 5 | } 6 | 7 | // Parse a formatted value in DMS DM or D to a numeric value 8 | // Delimiters: D|d (degrees), ' (minutes), " (seconds) 9 | function dmstod(str) { 10 | var match = /(-?[0-9.]+)d?([0-9.]*)'?([0-9.]*)"?([nsew]?)$/i.exec(str); 11 | var d = NaN; 12 | var deg, min, sec; 13 | if (match) { 14 | deg = match[1] || '0'; 15 | min = match[2] || '0'; 16 | sec = match[3] || '0'; 17 | d = (+deg) + (+min) / 60 + (+sec) / 3600; 18 | if (/[ws]/i.test(match[4])) { 19 | d = -d; 20 | } 21 | } 22 | if (isNaN(d)) { 23 | // throw an exception instead of just setting an error code 24 | // (assumes this function is called by pj_init() or a cli program, 25 | // where an exception is more appropriate) 26 | e_error(-16); 27 | // pj_ctx_set_errno(-16); 28 | // d = HUGE_VAL; 29 | } 30 | return d; 31 | } 32 | -------------------------------------------------------------------------------- /src/geodesic.js: -------------------------------------------------------------------------------- 1 | /* @requires Math Geodesic GeodesicLine PolygonArea */ 2 | -------------------------------------------------------------------------------- /src/nad_cvt.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbloch/mapshaper-proj/70b7ed193440208e4399032e539d2295bd68fb60/src/nad_cvt.js -------------------------------------------------------------------------------- /src/pj_apply_gridshift.js: -------------------------------------------------------------------------------- 1 | /* @requires nad_cvt */ 2 | 3 | // This implementation takes uses the gridlist from a coordinate 4 | // system definition. If the gridlist has not yet been 5 | // populated in the coordinate system definition we set it up now. 6 | function pj_apply_gridshift_2(defn, inverse, xx, yy, zz) { 7 | fatal("grishift not implemented"); 8 | } 9 | 10 | // public API function of Proj.4 11 | function pj_apply_gridshift(tables, inverse, xx, yy, zz) {} 12 | 13 | function pj_apply_gridshift_3(tables, inverse, xx, yy, zz) {} 14 | -------------------------------------------------------------------------------- /src/pj_auth.js: -------------------------------------------------------------------------------- 1 | 2 | function pj_authset(es) { 3 | var P00 = 0.33333333333333333333 /* 1 / 3 */, 4 | P01 = 0.17222222222222222222 /* 31 / 180 */, 5 | P02 = 0.10257936507936507937 /* 517 / 5040 */, 6 | P10 = 0.06388888888888888888 /* 23 / 360 */, 7 | P11 = 0.06640211640211640212 /* 251 / 3780 */, 8 | P20 = 0.01677689594356261023 /* 761 / 45360 */, 9 | APA = []; 10 | var t; 11 | 12 | APA[0] = es * P00; 13 | t = es * es; 14 | APA[0] += t * P01; 15 | APA[1] = t * P10; 16 | t *= es; 17 | APA[0] += t * P02; 18 | APA[1] += t * P11; 19 | APA[2] = t * P20; 20 | return APA; 21 | } 22 | 23 | function pj_authlat(beta, APA) { 24 | var t = beta + beta; 25 | return(beta + APA[0] * sin(t) + APA[1] * sin(t+t) + APA[2] * sin(t+t+t)); 26 | } 27 | -------------------------------------------------------------------------------- /src/pj_const.js: -------------------------------------------------------------------------------- 1 | 2 | // add math.h functions to library scope 3 | // (to make porting projection functions simpler) 4 | var fabs = Math.abs, 5 | floor = Math.floor, 6 | sin = Math.sin, 7 | cos = Math.cos, 8 | tan = Math.tan, 9 | asin = Math.asin, 10 | acos = Math.acos, 11 | atan = Math.atan, 12 | atan2 = Math.atan2, 13 | sqrt = Math.sqrt, 14 | pow = Math.pow, 15 | exp = Math.exp, 16 | log = Math.log, 17 | hypot = Math.hypot, 18 | sinh = Math.sinh, 19 | cosh = Math.cosh, 20 | MIN = Math.min, 21 | MAX = Math.max; 22 | 23 | // constants from math.h 24 | var HUGE_VAL = Infinity, 25 | M_PI = Math.PI; 26 | 27 | // from proj_api.h 28 | var RAD_TO_DEG = 57.295779513082321, 29 | DEG_TO_RAD = 0.017453292519943296; 30 | 31 | // from pj_transform.c 32 | var SRS_WGS84_SEMIMAJOR = 6378137; 33 | var SRS_WGS84_ESQUARED = 0.0066943799901413165; 34 | 35 | // math constants from project.h 36 | var M_FORTPI = M_PI / 4, 37 | M_HALFPI = M_PI / 2, 38 | M_PI_HALFPI = 1.5 * M_PI, 39 | M_TWOPI = 2 * M_PI, 40 | M_TWO_D_PI = 2 / M_PI, 41 | M_TWOPI_HALFPI = 2.5 * M_PI; 42 | 43 | // datum types 44 | var PJD_UNKNOWN = 0, 45 | PJD_3PARAM = 1, 46 | PJD_7PARAM = 2, 47 | PJD_GRIDSHIFT = 3, 48 | PJD_WGS84 = 4; 49 | 50 | // named errors 51 | var PJD_ERR_GEOCENTRIC = -45, 52 | PJD_ERR_AXIS = -47, 53 | PJD_ERR_GRID_AREA = -48, 54 | PJD_ERR_CATALOG = -49; 55 | 56 | // common 57 | var EPS10 = 1e-10; 58 | -------------------------------------------------------------------------------- /src/pj_ctx.js: -------------------------------------------------------------------------------- 1 | var PJ_LOG_NONE = 0, 2 | PJ_LOG_ERROR = 1, 3 | PJ_LOG_DEBUG_MAJOR = 2, 4 | PJ_LOG_DEBUG_MINOR = 3; 5 | 6 | // context of currently running projection function 7 | // (Unlike Proj.4, we use a single ctx object) 8 | var ctx = { 9 | last_errno: 0, 10 | debug_level: PJ_LOG_NONE, 11 | logger: null // TODO: implement 12 | }; 13 | -------------------------------------------------------------------------------- /src/pj_datum_set.js: -------------------------------------------------------------------------------- 1 | /* @requires pj_datums */ 2 | 3 | function pj_datum_set(P) { 4 | var SEC_TO_RAD = 4.84813681109535993589914102357e-6; 5 | var params = P.datum_params = [0,0,0,0,0,0,0]; 6 | var name, datum, nadgrids, catalog, towgs84; 7 | 8 | P.datum_type = PJD_UNKNOWN; 9 | 10 | if (name = pj_param(P.params, 'sdatum')) { 11 | datum = find_datum(name); 12 | if (!datum) { 13 | error(-9); 14 | } 15 | if (datum.ellipse_id) { 16 | pj_mkparam(P.params, 'ellps=' + datum.ellipse_id); 17 | } 18 | if (datum.defn) { 19 | pj_mkparam(P.params, datum.defn); 20 | } 21 | } 22 | 23 | nadgrids = pj_param(P.params, "snadgrids"); 24 | if (nadgrids && nadgrids != '@null') { 25 | fatal("+nadgrids is not implemented"); 26 | } 27 | if (catalog = pj_param(P.params, "scatalog")) { 28 | fatal("+catalog is not implemented"); 29 | } 30 | if (towgs84 = pj_param(P.params, "stowgs84")) { 31 | towgs84.split(',').forEach(function(s, i) { 32 | params[i] = pj_atof(s) || 0; 33 | }); 34 | if (params[3] != 0 || params[4] != 0 || params[5] != 0 || params[6] != 0) { 35 | P.datum_type = PJD_7PARAM; 36 | params[3] *= SEC_TO_RAD; 37 | params[4] *= SEC_TO_RAD; 38 | params[5] *= SEC_TO_RAD; 39 | params[6] = params[6] / 1e6 + 1; 40 | } else { 41 | P.datum_type = PJD_3PARAM; 42 | /* Note that pj_init() will later switch datum_type to 43 | PJD_WGS84 if shifts are all zero, and ellipsoid is WGS84 or GRS80 */ 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/pj_err.js: -------------------------------------------------------------------------------- 1 | /* @requires pj_ctx, pj_strerrno */ 2 | 3 | // see pj_transform.c CHECK_RETURN() 4 | function check_fatal_error() { 5 | var code = ctx.last_errno; 6 | if (!code) return; 7 | if (code > 0 || !is_transient_error(code)) { 8 | e_error(code); 9 | } else { 10 | // transient error 11 | // TODO: consider a strict mode that throws an error 12 | } 13 | } 14 | 15 | function is_transient_error(code) { 16 | return transient_error.indexOf(code) > -1; 17 | } 18 | 19 | var transient_error = [-14, -15, -17, -18, -19, -20, -27, -48]; 20 | 21 | function pj_ctx_set_errno(code) { 22 | ctx.last_errno = code; 23 | } 24 | 25 | function f_error() { 26 | pj_ctx_set_errno(-20); 27 | } 28 | 29 | function i_error() { 30 | pj_ctx_set_errno(-20); 31 | } 32 | 33 | function error_msg(code) { 34 | return pj_err_list[~code] || "unknown error"; 35 | } 36 | 37 | // alias for e_error() 38 | function error(code) { 39 | e_error(code); 40 | } 41 | 42 | // a fatal error 43 | // see projects.h E_ERROR macro 44 | function e_error(code) { 45 | pj_ctx_set_errno(code); 46 | fatal(); 47 | } 48 | 49 | function fatal(msg, o) { 50 | if (!o) o = {}; 51 | if (!o.code) o.code = ctx.last_errno || 0; 52 | if (!msg) msg = error_msg(o.code); 53 | // reset error code, so processing can continue after this error is handled 54 | ctx.last_errno = 0; 55 | throw new ProjError(msg, o); 56 | } 57 | 58 | function ProjError(msg, o) { 59 | var err = new Error(msg); 60 | err.name = 'ProjError'; 61 | Object.keys(o).forEach(function(k) { 62 | err[k] = o[k]; 63 | }); 64 | return err; 65 | } 66 | -------------------------------------------------------------------------------- /src/pj_fwd.js: -------------------------------------------------------------------------------- 1 | /* @requires adjlon */ 2 | 3 | function pj_fwd_deg(lp, P) { 4 | var lp2 = {lam: lp.lam * DEG_TO_RAD, phi: lp.phi * DEG_TO_RAD}; 5 | return pj_fwd(lp2, P); 6 | } 7 | 8 | function pj_fwd(lp, P) { 9 | var xy = {x: 0, y: 0}; 10 | var EPS = 1e-12; 11 | var t = fabs(lp.phi) - M_HALFPI; 12 | 13 | // if (t > EPS || fabs(lp.lam) > 10) { 14 | if (!(t <= EPS && fabs(lp.lam) <= 10)) { // catch NaNs 15 | pj_ctx_set_errno(-14); 16 | } else { 17 | ctx.last_errno = 0; // clear a previous error 18 | if (fabs(t) <= EPS) { 19 | lp.phi = lp.phi < 0 ? -M_HALFPI : M_HALFPI; 20 | } else if (P.geoc) { 21 | lp.phi = atan(P.rone_es * tan(lp.phi)); 22 | } 23 | lp.lam -= P.lam0; 24 | if (!P.over) { 25 | lp.lam = adjlon(lp.lam); 26 | } 27 | if (P.fwd) { 28 | P.fwd(lp, xy); 29 | xy.x = P.fr_meter * (P.a * xy.x + P.x0); 30 | xy.y = P.fr_meter * (P.a * xy.y + P.y0); 31 | } else { 32 | xy.x = xy.y = HUGE_VAL; 33 | } 34 | } 35 | if (ctx.last_errno || !isFinite(xy.x) || !isFinite(xy.y)) { 36 | // isFinite() catches NaN and +/- Infinity but not null 37 | xy.x = xy.y = HUGE_VAL; 38 | } 39 | return xy; 40 | } 41 | -------------------------------------------------------------------------------- /src/pj_gauss.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | function srat(esinp, exp) { 4 | return pow((1-esinp)/(1+esinp), exp); 5 | } 6 | 7 | function pj_gauss_ini(e, phi0) { 8 | var es = e * e, 9 | sphi = sin(phi0), 10 | cphi = cos(phi0), 11 | rc = sqrt(1 - es) / (1 - es * sphi * sphi), 12 | C = sqrt(1 + es * cphi * cphi * cphi * cphi / (1 - es)), 13 | // ignoring Proj.4 div0 check (seems unneccessary) 14 | chi = asin(sphi / C), 15 | ratexp = 0.5 * C * e, 16 | K = tan(0.5 * chi + M_FORTPI) / (pow(tan(0.5 * phi0 + M_FORTPI), C) * 17 | srat(e * sphi, ratexp)); 18 | return {e: e, K: K, C: C, chi: chi, ratexp: ratexp, rc: rc}; 19 | } 20 | 21 | function pj_gauss(elp, en) { 22 | return { 23 | phi: 2 * atan( en.K * pow(tan(0.5 * elp.phi + M_FORTPI), en.C) * 24 | srat(en.e * sin(elp.phi), en.ratexp) ) - M_HALFPI, 25 | lam: en.C * elp.lam 26 | }; 27 | } 28 | 29 | function pj_inv_gauss(lp, en) { 30 | var MAX_ITER = 20, 31 | DEL_TOL = 1e-14, 32 | phi1 = lp.phi, 33 | num = pow(tan(0.5 * lp.phi + M_FORTPI)/en.K, 1/en.C), 34 | i, phi; 35 | lp.lam /= en.C; 36 | for (i = MAX_ITER; i>0; --i) { 37 | phi = 2 * atan(num * srat(en.e * sin(lp.phi), -0.5 * en.e)) - M_HALFPI; 38 | if (fabs(phi - lp.phi) < DEL_TOL) break; 39 | lp.phi = phi; 40 | } 41 | if (!i) pj_ctx_set_errno(-17); /* convergence failed */ 42 | } 43 | -------------------------------------------------------------------------------- /src/pj_initcache.js: -------------------------------------------------------------------------------- 1 | 2 | var initcache = {}; 3 | 4 | function pj_search_initcache(key) { 5 | return initcache[key.toLowerCase()] || null; 6 | } 7 | 8 | function pj_insert_initcache(key, defn) { 9 | initcache[key.toLowerCase()] = defn; 10 | } 11 | -------------------------------------------------------------------------------- /src/pj_inv.js: -------------------------------------------------------------------------------- 1 | /* @requires adjlon */ 2 | 3 | function pj_inv_deg(xy, P) { 4 | var lp = pj_inv(xy, P); 5 | return { 6 | lam: lp.lam * RAD_TO_DEG, 7 | phi: lp.phi * RAD_TO_DEG 8 | }; 9 | } 10 | 11 | function pj_inv(xy, P) { 12 | var EPS = 1e-12; 13 | var lp = {lam: 0, phi: 0}; 14 | 15 | // if (xy.x == HUGE_VAL || xy.y == HUGE_VAL) { 16 | if (!(xy.x < HUGE_VAL && xy.y < HUGE_VAL)) { // catch NaNs 17 | pj_ctx_set_errno(-15); 18 | } else { 19 | ctx.last_errno = 0; 20 | if (P.inv) { 21 | xy.x = (xy.x * P.to_meter - P.x0) * P.ra; 22 | xy.y = (xy.y * P.to_meter - P.y0) * P.ra; 23 | P.inv(xy, lp); 24 | lp.lam += P.lam0; 25 | if (!P.over) { 26 | lp.lam = adjlon(lp.lam); 27 | } 28 | if (P.geoc && fabs(fabs(lp.phi) - M_HALFPI) > EPS) { 29 | lp.phi = atan(P.one_es * tan(lp.phi)); 30 | } 31 | } else { 32 | lp.lam = lp.phi = HUGE_VAL; 33 | } 34 | } 35 | if (ctx.last_errno || !isFinite(lp.lam) || !isFinite(lp.phi)) { 36 | // isFinite() catches NaN and +/- Infinity but not null 37 | lp.lam = lp.phi = HUGE_VAL; 38 | } 39 | return lp; 40 | } 41 | -------------------------------------------------------------------------------- /src/pj_list.js: -------------------------------------------------------------------------------- 1 | 2 | var pj_list = {}; 3 | 4 | function pj_add(func, key, name, desc) { 5 | pj_list[key] = { 6 | init: func, 7 | name: name, 8 | description: desc 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /src/pj_mlfn.js: -------------------------------------------------------------------------------- 1 | 2 | function pj_enfn(es) { 3 | var C00 = 1, 4 | C02 = 0.25, 5 | C04 = 0.046875, 6 | C06 = 0.01953125, 7 | C08 = 0.01068115234375, 8 | C22 = 0.75, 9 | C44 = 0.46875, 10 | C46 = 0.01302083333333333333, 11 | C48 = 0.00712076822916666666, 12 | C66 = 0.36458333333333333333, 13 | C68 = 0.00569661458333333333, 14 | C88 = 0.3076171875; 15 | var en = [], t; 16 | en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08))); 17 | en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08))); 18 | en[2] = (t = es * es) * (C44 - es * (C46 + es * C48)); 19 | en[3] = (t *= es) * (C66 - es * C68); 20 | en[4] = t * es * C88; 21 | return en; 22 | } 23 | 24 | function pj_mlfn(phi, sphi, cphi, en) { 25 | cphi *= sphi; 26 | sphi *= sphi; 27 | return (en[0] * phi - cphi * (en[1] + sphi*(en[2] + sphi*(en[3] + sphi*en[4])))); 28 | } 29 | 30 | function pj_inv_mlfn(arg, es, en) { 31 | var EPS = 1e-11, 32 | MAX_ITER = 10, 33 | EN_SIZE = 5; 34 | 35 | var k = 1 / (1 - es), 36 | s, t, phi; 37 | 38 | phi = arg; 39 | for (var i = MAX_ITER; i>0; --i) { /* rarely goes over 2 iterations */ 40 | s = sin(phi); 41 | t = 1 - es * s * s; 42 | phi -= t = (pj_mlfn(phi, s, cos(phi), en) - arg) * (t * sqrt(t)) * k; 43 | if (fabs(t) < EPS) { 44 | return phi; 45 | } 46 | } 47 | pj_ctx_set_errno( ctx, -17 ); 48 | return phi; 49 | } 50 | -------------------------------------------------------------------------------- /src/pj_msfn.js: -------------------------------------------------------------------------------- 1 | function pj_msfn(sinphi, cosphi, es) { 2 | return (cosphi / sqrt (1 - es * sinphi * sinphi)); 3 | } 4 | -------------------------------------------------------------------------------- /src/pj_phi2.js: -------------------------------------------------------------------------------- 1 | /* @requires pj_ctx */ 2 | 3 | function pj_phi2(ts, e) { 4 | var N_ITER = 15, 5 | TOL = 1e-10, 6 | eccnth = 0.5 * e, 7 | Phi = M_HALFPI - 2 * atan(ts), 8 | i = N_ITER, 9 | con, dphi; 10 | 11 | do { 12 | con = e * sin(Phi); 13 | dphi = M_HALFPI - 2 * atan(ts * pow((1 - con) / 14 | (1 + con), eccnth)) - Phi; 15 | Phi += dphi; 16 | } while (fabs(dphi) > TOL && --i); 17 | if (i <= 0) { 18 | pj_ctx_set_errno(-18); 19 | } 20 | return Phi; 21 | } 22 | -------------------------------------------------------------------------------- /src/pj_qsfn.js: -------------------------------------------------------------------------------- 1 | function pj_qsfn(sinphi, e, one_es) { 2 | var EPS = 1e-7; 3 | var con; 4 | if (e >= EPS) { 5 | con = e * sinphi; 6 | // Proj.4 check for div0 and returns HUGE_VAL 7 | // this returns +/- Infinity; effect should be same 8 | return (one_es * (sinphi / (1 - con * con) - 9 | (0.5 / e) * log ((1 - con) / (1 + con)))); 10 | } else 11 | return (sinphi + sinphi); 12 | } 13 | -------------------------------------------------------------------------------- /src/pj_strtod.js: -------------------------------------------------------------------------------- 1 | 2 | function pj_atof(str) { 3 | return pj_strtod(str); 4 | } 5 | 6 | function pj_strtod(str) { 7 | return parseFloat(str); 8 | } 9 | -------------------------------------------------------------------------------- /src/pj_tsfn.js: -------------------------------------------------------------------------------- 1 | 2 | function pj_tsfn(phi, sinphi, e) { 3 | sinphi *= e; 4 | // Proj.4 returns HUGE_VAL on div0; this returns +/- Infinity; effect should be same 5 | return (tan(0.5 * (M_HALFPI - phi)) / 6 | pow((1 - sinphi) / (1 + sinphi), 0.5 * e)); 7 | } 8 | -------------------------------------------------------------------------------- /src/pj_units.js: -------------------------------------------------------------------------------- 1 | 2 | var pj_units = [ 3 | // id to_meter name 4 | ["km", "1000", "Kilometer"], 5 | ["m", "1", "Meter"], 6 | ["dm", "1/10", "Decimeter"], 7 | ["cm", "1/100", "Centimeter"], 8 | ["mm", "1/1000", "Millimeter"], 9 | ["kmi", "1852.0", "International Nautical Mile"], 10 | ["in", "0.0254", "International Inch"], 11 | ["ft", "0.3048", "International Foot"], 12 | ["yd", "0.9144", "International Yard"], 13 | ["mi", "1609.344", "International Statute Mile"], 14 | ["fath", "1.8288", "International Fathom"], 15 | ["ch", "20.1168", "International Chain"], 16 | ["link", "0.201168", "International Link"], 17 | ["us-in", "1/39.37", "U.S. Surveyor's Inch"], 18 | ["us-ft", "0.304800609601219", "U.S. Surveyor's Foot"], 19 | ["us-yd", "0.914401828803658", "U.S. Surveyor's Yard"], 20 | ["us-ch", "20.11684023368047", "U.S. Surveyor's Chain"], 21 | ["us-mi", "1609.347218694437", "U.S. Surveyor's Statute Mile"], 22 | ["ind-yd", "0.91439523", "Indian Yard"], 23 | ["ind-ft", "0.30479841", "Indian Foot"], 24 | ["ind-ch", "20.11669506", "Indian Chain"], 25 | [null, null, null] 26 | ]; 27 | 28 | function find_units_by_value(val) { 29 | return pj_units.reduce(function(memo, defn) { 30 | if (val == +defn[1]) { 31 | memo = find_units(defn[0]); 32 | } 33 | return memo; 34 | }, null); 35 | } 36 | 37 | function find_units(id) { 38 | var arr = pj_units.reduce(function(memo, defn) { 39 | return id === defn[0] ? defn : memo; 40 | }, null); 41 | return arr ? {id: arr[0], to_meter: arr[1], name: arr[2]} : null; 42 | } 43 | -------------------------------------------------------------------------------- /src/pj_zpoly1.js: -------------------------------------------------------------------------------- 1 | /* evaluate complex polynomial */ 2 | 3 | /* note: coefficients are always from C_1 to C_n 4 | ** i.e. C_0 == (0., 0) 5 | ** n should always be >= 1 though no checks are made 6 | */ 7 | // z: Complex number (object with r and i properties) 8 | // C: Array of complex numbers 9 | // returns: complex number 10 | function pj_zpoly1(z, C) { 11 | var t, r, i; 12 | var n = C.length - 1; 13 | r = C[n][0]; 14 | i = C[n][1]; 15 | while (--n >= 0) { 16 | t = r; 17 | r = C[n][0] + z.r * t - z.i * i; 18 | i = C[n][1] + z.r * i + z.i * t; 19 | } 20 | return { 21 | r: z.r * r - z.i * i, 22 | i: z.r * i + z.i * r 23 | }; 24 | } 25 | 26 | /* evaluate complex polynomial and derivative */ 27 | function pj_zpolyd1(z, C, der) { 28 | var ai, ar, bi, br, t; 29 | var first = true; 30 | var n = C.length - 1; 31 | ar = br = C[n][0]; 32 | ai = bi = C[n][1]; 33 | while (--n >= 0) { 34 | if (first) { 35 | first = false; 36 | } else { 37 | br = ar + z.r * (t = br) - z.i * bi; 38 | bi = ai + z.r * bi + z.i * t; 39 | } 40 | ar = C[n][0] + z.r * (t = ar) - z.i * ai; 41 | ai = C[n][1] + z.r * ai + z.i * t; 42 | } 43 | der.r = ar + z.r * br - z.i * bi; 44 | der.i = ai + z.r * bi + z.i * br; 45 | return { 46 | r: z.r * ar - z.i * ai, 47 | i: z.r * ai + z.i * ar 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /src/proj4js_compat.js: -------------------------------------------------------------------------------- 1 | // Support for the proj4js api: 2 | // proj4(fromProjection[, toProjection, coordinates]) 3 | 4 | function proj4js(arg1, arg2, arg3) { 5 | var p, fromStr, toStr, P1, P2, transform; 6 | if (typeof arg1 != 'string') { 7 | // E.g. Webpack's require function tries to initialize mproj by calling 8 | // the module function. 9 | return api; 10 | } else if (typeof arg2 != 'string') { 11 | fromStr = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'; // '+datum=WGS84 +proj=lonlat'; 12 | toStr = arg1; 13 | p = arg2; 14 | } else { 15 | fromStr = arg1; 16 | toStr = arg2; 17 | p = arg3; 18 | } 19 | P1 = pj_init(fromStr); 20 | P2 = pj_init(toStr); 21 | transform = get_proj4js_transform(P1, P2); 22 | if (p) { 23 | return transform(p); 24 | } else { 25 | return {forward: transform, inverse: get_proj4js_transform(P2, P1)}; 26 | } 27 | } 28 | 29 | proj4js.WGS84 = '+proj=longlat +datum=WGS84'; // for compatibility with proj4js tests 30 | 31 | // for compatibility with proj4js tests 32 | proj4js.toPoint = function(array) { 33 | var out = { 34 | x: array[0], 35 | y: array[1] 36 | }; 37 | if (array.length>2) { 38 | out.z = array[2]; 39 | } 40 | if (array.length>3) { 41 | out.m = array[3]; 42 | } 43 | return out; 44 | }; 45 | 46 | function get_proj4js_transform(P1, P2) { 47 | return function(p) { 48 | var useArray = Array.isArray(p); 49 | p = useArray ? p.concat() : [p.x, p.y]; 50 | pj_transform_point(P1, P2, p); 51 | if (!useArray) { 52 | p = {x: p[0], y: p[1]}; 53 | } 54 | return p; 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /src/projections/august.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_august, 'august', 'August Epicycloidal', 'Misc Sph, no inv.'); 2 | 3 | function pj_august(P) { 4 | P.fwd = s_fwd; 5 | P.es = 0; 6 | 7 | function s_fwd(lp, xy) { 8 | var M = 4 / 3; 9 | var lam = lp.lam; 10 | var t, c1, c, x1, x12, y1, y12; 11 | t = tan(0.5 * lp.phi); 12 | c1 = sqrt(1 - t * t); 13 | c = 1 + c1 * cos(lam *= 0.5); 14 | x1 = sin(lam) * c1 / c; 15 | y1 = t / c; 16 | xy.x = M * x1 * (3 + (x12 = x1 * x1) - 3 * (y12 = y1 * y1)); 17 | xy.y = M * y1 * (3 + 3 * x12 - y12); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/projections/bacon.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_apian, 'apian', 'Apian Globular I', 'Misc Sph, no inv.'); 2 | pj_add(pj_ortel, 'ortel', 'Ortelius Oval', 'Misc Sph, no inv.'); 3 | pj_add(pj_bacon, 'bacon', 'Bacon Globular', 'Misc Sph, no inv.'); 4 | 5 | function pj_bacon(P) { 6 | pj_bacon_init(P, true, false); 7 | } 8 | 9 | function pj_apian(P) { 10 | pj_bacon_init(P, false, false); 11 | } 12 | 13 | function pj_ortel(P) { 14 | pj_bacon_init(P, false, true); 15 | } 16 | 17 | function pj_bacon_init(P, bacn, ortl) { 18 | P.es = 0; 19 | P.fwd = s_fwd; 20 | 21 | function s_fwd(lp, xy) { 22 | var HLFPI2 = 2.46740110027233965467; /* (pi/2)^2 */ 23 | var EPS = 1e-10; 24 | var ax, f; 25 | xy.y = bacn ? M_HALFPI * sin(lp.phi) : lp.phi; 26 | if ((ax = fabs(lp.lam)) >= EPS) { 27 | if (ortl && ax >= M_HALFPI) 28 | xy.x = sqrt(HLFPI2 - lp.phi * lp.phi + EPS) + ax - M_HALFPI; 29 | else { 30 | f = 0.5 * (HLFPI2 / ax + ax); 31 | xy.x = ax - f + sqrt(f * f - xy.y * xy.y); 32 | } 33 | if (lp.lam < 0) xy.x = - xy.x; 34 | } else 35 | xy.x = 0; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/projections/boggs.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_boggs, 'boggs', 'Boggs Eumorphic', 'PCyl., no inv., Sph.'); 2 | 3 | function pj_boggs(P) { 4 | var NITER = 20, 5 | EPS = 1e-7, 6 | ONETOL = 1.000001, 7 | M_SQRT2 = sqrt(2), 8 | FXC = 2.00276, 9 | FXC2 = 1.11072, 10 | FYC = 0.49931; 11 | P.fwd = s_fwd; 12 | P.es = 0; 13 | 14 | function s_fwd(lp, xy) { 15 | var theta, th1, c, i; 16 | theta = lp.phi; 17 | if (fabs(fabs(lp.phi) - M_HALFPI) < EPS) 18 | xy.x = 0; 19 | else { 20 | c = sin(theta) * M_PI; 21 | for (i = NITER; i; --i) { 22 | theta -= th1 = (theta + sin(theta) - c) / 23 | (1 + cos(theta)); 24 | if (fabs(th1) < EPS) break; 25 | } 26 | theta *= 0.5; 27 | xy.x = FXC * lp.lam / (1 / cos(lp.phi) + FXC2 / cos(theta)); 28 | } 29 | xy.y = FYC * (lp.phi + M_SQRT2 * sin(theta)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/projections/cass.js: -------------------------------------------------------------------------------- 1 | /* @requires pj_mlfn */ 2 | 3 | pj_add(pj_cass, 'cass', 'Cassini', 'Cyl, Sph&Ell'); 4 | 5 | function pj_cass(P) { 6 | var C1 = 0.16666666666666666666, 7 | C2 = 0.00833333333333333333, 8 | C3 = 0.04166666666666666666, 9 | C4 = 0.33333333333333333333, 10 | C5 = 0.06666666666666666666; 11 | var m0, en; 12 | 13 | if (P.es) { 14 | en = pj_enfn(P.es); 15 | m0 = pj_mlfn(P.phi0, sin(P.phi0), cos(P.phi0), en); 16 | P.fwd = e_fwd; 17 | P.inv = e_inv; 18 | } else { 19 | P.fwd = s_fwd; 20 | P.inv = s_inv; 21 | } 22 | 23 | function e_fwd(lp, xy) { 24 | var n, t, a1, c, a2, tn; 25 | xy.y = pj_mlfn(lp.phi, n = sin(lp.phi), c = cos(lp.phi), en); 26 | 27 | n = 1/sqrt(1 - P.es * n*n); 28 | tn = tan(lp.phi); t = tn * tn; 29 | a1 = lp.lam * c; 30 | c *= P.es * c / (1 - P.es); 31 | a2 = a1 * a1; 32 | 33 | xy.x = n * a1 * (1 - a2 * t * (C1 - (8 - t + 8 * c) * a2 * C2)); 34 | xy.y -= m0 - n * tn * a2 * (0.5 + (5 - t + 6 * c) * a2 * C3); 35 | } 36 | 37 | function e_inv(xy, lp) { 38 | var n, t, r, dd, d2, tn, ph1; 39 | ph1 = pj_inv_mlfn (m0 + xy.y, P.es, en); 40 | tn = tan(ph1); t = tn*tn; 41 | n = sin(ph1); 42 | r = 1 / (1 - P.es * n * n); 43 | n = sqrt (r); 44 | r *= (1 - P.es) * n; 45 | dd = xy.x / n; 46 | d2 = dd * dd; 47 | lp.phi = ph1 - (n * tn / r) * d2 *(0.5 - (1 + 3 * t) * d2 * C3); 48 | lp.lam = dd * (1 + t * d2 * (-C4 + (1 + 3 * t) * d2 * C5)) / cos(ph1); 49 | } 50 | 51 | function s_fwd(lp, xy) { 52 | xy.x = asin(cos(lp.phi) * sin(lp.lam)); 53 | xy.y = atan2(tan(lp.phi), cos(lp.lam)) - P.phi0; 54 | } 55 | 56 | function s_inv(xy, lp) { 57 | var dd = xy.y + P.phi0; 58 | lp.phi = asin(sin(dd) * cos(xy.x)); 59 | lp.lam = atan2(tan(xy.x), cos(dd)); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/projections/cea.js: -------------------------------------------------------------------------------- 1 | /* @requires pj_qsfn pj_auth */ 2 | 3 | pj_add(pj_cea, 'cea', 'Equal Area Cylindrical', 'Cyl, Sph&Ell\nlat_ts='); 4 | 5 | function pj_cea(P) { 6 | var t = 0, qp, apa; 7 | if (pj_param(P.params, "tlat_ts")) { 8 | P.k0 = cos(t = pj_param(P.params, "rlat_ts")); 9 | if (P.k0 < 0) { 10 | e_error(-24); 11 | } 12 | } 13 | if (P.es) { 14 | t = sin(t); 15 | P.k0 /= sqrt(1 - P.es * t * t); 16 | P.e = sqrt(P.es); 17 | if (!(apa = pj_authset(P.es))) e_error_0(); 18 | qp = pj_qsfn(1, P.e, P.one_es); 19 | P.fwd = e_fwd; 20 | P.inv = e_inv; 21 | } else { 22 | P.fwd = s_fwd; 23 | P.inv = s_inv; 24 | } 25 | 26 | function e_fwd(lp, xy) { 27 | xy.x = P.k0 * lp.lam; 28 | xy.y = 0.5 * pj_qsfn(sin (lp.phi), P.e, P.one_es) / P.k0; 29 | } 30 | 31 | function e_inv(xy, lp) { 32 | lp.phi = pj_authlat(asin(2 * xy.y * P.k0 / qp), apa); 33 | lp.lam = xy.x / P.k0; 34 | } 35 | 36 | function s_fwd(lp, xy) { 37 | xy.x = P.k0 * lp.lam; 38 | xy.y = sin(lp.phi) / P.k0; 39 | } 40 | 41 | function s_inv(xy, lp) { 42 | var x = xy.x, y = xy.y; 43 | var t; 44 | if ((t = fabs(y *= P.k0)) - EPS10 <= 1) { 45 | if (t >= 1) 46 | lp.phi = y < 0 ? -M_HALFPI : M_HALFPI; 47 | else 48 | lp.phi = asin(y); 49 | lp.lam = x / P.k0; 50 | } else i_error(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/projections/crast.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_crast, 'crast', 'Craster Parabolic (Putnins P4)', 'PCyl., Sph.'); 2 | 3 | function pj_crast(P) { 4 | var XM = 0.97720502380583984317; 5 | var RXM = 1.02332670794648848847; 6 | var YM = 3.06998012383946546542; 7 | var RYM = 0.32573500793527994772; 8 | var THIRD = 1/3; 9 | P.inv = s_inv; 10 | P.fwd = s_fwd; 11 | P.es = 0; 12 | 13 | function s_fwd(lp, xy) { 14 | lp.phi *= THIRD; 15 | xy.x = XM * lp.lam * (2 * cos(lp.phi + lp.phi) - 1); 16 | xy.y = YM * sin(lp.phi); 17 | } 18 | 19 | function s_inv(xy, lp) { 20 | lp.phi = 3 * asin(xy.y * RYM); 21 | lp.lam = xy.x * RXM / (2 * cos((lp.phi + lp.phi) * THIRD) - 1); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/projections/cupola.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_cupola, 'cupola', 'Cupola', 'PCyl., Sph., NoInv.'); 2 | 3 | // Source: https://www.tandfonline.com/eprint/EE7Y8RK4GXA4ITWUTQPY/full?target=10.1080/23729333.2020.1862962 4 | // See also: http://www.at-a-lanta.nl/weia/cupola.html 5 | 6 | function pj_cupola(P) { 7 | var de = 0.5253; // part of the equator on intermediate sphere, default = 1 8 | var dp = 0.7264; // sin of angle of polar line, default = 1 9 | var ri = 1 / Math.sqrt(de * dp); 10 | var he = 0.4188; // height of equator (can be negative, default = 0) 11 | var se = 0.9701; // stretch in plane, default = 1 12 | var phi0 = 22 * DEG_TO_RAD; // phi of projection center 13 | // center of projection on intermediate sphere 14 | var pc = calcP(phi0); 15 | var qc = calcQ(0); 16 | var spc = sin(pc); 17 | var cpc = cos(pc); 18 | 19 | // apply default central meridian 20 | if (!pj_param(P.params, 'tlon_0')) { 21 | P.lam0 = 11.023 * DEG_TO_RAD; 22 | } 23 | 24 | P.es = 0; 25 | P.fwd = s_fwd; 26 | 27 | function calcP(phi) { 28 | return asin(dp * sin(phi) + he * sqrt(de * dp)); 29 | } 30 | 31 | function calcQ(lam) { 32 | return de * lam; 33 | } 34 | 35 | function s_fwd(lp, xy) { 36 | var p = calcP(lp.phi); 37 | var q = calcQ(lp.lam); 38 | var sp = sin(p); 39 | var cp = cos(p); 40 | var sqqc = sin(q - qc); 41 | var cqqc = cos(q - qc); 42 | var K = sqrt(2 / (1 + sin(pc) * sp + cpc * cp * cqqc)); 43 | xy.x = ri * K * cp * sqqc * se; 44 | xy.y = ri * K * (cpc * sp - spc * cp * cqqc) / se; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/projections/denoy.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_denoy, 'denoy', 'Denoyer Semi-Elliptical', 'PCyl, Sph., no inv.'); 2 | 3 | function pj_denoy(P) { 4 | P.fwd = s_fwd; 5 | P.es = 0; 6 | 7 | function s_fwd(lp, xy) { 8 | var C0 = 0.95; 9 | var C1 = -0.08333333333333333333; 10 | var C3 = 0.00166666666666666666; 11 | var D1 = 0.9; 12 | var D5 = 0.03; 13 | var lam = fabs(lp.lam); 14 | xy.y = lp.phi; 15 | xy.x = lp.lam; 16 | xy.x *= cos((C0 + lam * (C1 + lam * lam * C3)) * 17 | (lp.phi * (D1 + D5 * lp.phi * lp.phi * lp.phi * lp.phi))); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/projections/eqc.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_eqc, 'eqc', 'Equidistant Cylindrical (Plate Caree)', 'Cyl, Sph\nlat_ts=[, lat_0=0]'); 2 | 3 | function pj_eqc(P) { 4 | var rc = cos(pj_param(P.params, "rlat_ts")); 5 | if (rc <= 0) e_error(-24); 6 | P.es = 0; 7 | P.fwd = s_fwd; 8 | P.inv = s_inv; 9 | 10 | function s_fwd(lp, xy) { 11 | xy.x = rc * lp.lam; 12 | xy.y = lp.phi -P.phi0; 13 | } 14 | 15 | function s_inv(xy, lp) { 16 | lp.lam = xy.x / rc; 17 | lp.phi = xy.y + P.phi0; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/projections/gall.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_gall, 'gall', 'Gall (Gall Stereographic)', 'Cyl, Sph'); 2 | 3 | function pj_gall(P) { 4 | var YF = 1.70710678118654752440, 5 | XF = 0.70710678118654752440, 6 | RYF = 0.58578643762690495119, 7 | RXF = 1.41421356237309504880; 8 | 9 | P.fwd = s_fwd; 10 | P.inv = s_inv; 11 | P.es = 0; 12 | 13 | function s_fwd(lp, xy) { 14 | xy.x = XF * lp.lam; 15 | xy.y = YF * tan(0.5 * lp.phi); 16 | } 17 | 18 | function s_inv(xy, lp) { 19 | lp.lam = RXF * xy.x; 20 | lp.phi = 2 * atan(xy.y * RYF); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/projections/geocent.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_geocent, 'geocent', 'Geocentric', ''); 2 | 3 | function pj_geocent(P) { 4 | P.is_geocent = true; 5 | P.x0 = 0; 6 | P.y0 = 0; 7 | 8 | P.fwd = function (lp, xy) { 9 | xy.x = lp.lam; 10 | xy.y = lp.phi; 11 | }; 12 | 13 | P.inv = function(xy, lp) { 14 | lp.phi = xy.y; 15 | lp.lam = xy.x; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /src/projections/gilbert.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | // from 3 | 4 | pj_add(pj_gilbert, 'gilbert', 'Gilbert Two World Perspective', 'PCyl., Sph., NoInv.\nlat_1='); 5 | 6 | function pj_gilbert(P) { 7 | var lat1 = pj_param(P.params, 'tlat_1') ? pj_param(P.params, 'rlat_1') : 0, 8 | phi1 = phiprime(lat1), 9 | sp1 = sin(phi1), 10 | cp1 = cos(phi1); 11 | P.fwd = s_fwd; 12 | P.es = 0; 13 | 14 | function s_fwd(lp, xy) { 15 | var lam = lp.lam * 0.5, 16 | phi = phiprime(lp.phi), 17 | sp = sin(phi), 18 | cp = cos(phi), 19 | cl = cos(lam); 20 | if ((sp1*sp + cp1*cp*cl) >= 0) { 21 | xy.x = cp * sin(lam); 22 | xy.y = cp1 * sp - sp1 * cp * cl; 23 | } else { 24 | f_error(); 25 | } 26 | } 27 | 28 | function phiprime(phi) { 29 | return aasin(tan(0.5 * phi)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/projections/gins8.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_gins8, 'gins8', 'Ginsburg VIII (TsNIIGAiK)', 'PCyl, Sph., no inv.'); 2 | 3 | function pj_gins8(P) { 4 | P.fwd = s_fwd; 5 | P.es = 0; 6 | 7 | function s_fwd(lp, xy) { 8 | var Cl = 0.000952426; 9 | var Cp = 0.162388; 10 | var C12 = 0.08333333333333333; 11 | var t = lp.phi * lp.phi; 12 | xy.y = lp.phi * (1 + t * C12); 13 | xy.x = lp.lam * (1 - Cp * t); 14 | t = lp.lam * lp.lam; 15 | xy.x *= (0.87 - Cl * t * t); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/projections/goode.js: -------------------------------------------------------------------------------- 1 | /* @requires gn_sinu, moll */ 2 | pj_add(pj_goode, 'goode', 'Goode Homolosine', 'PCyl, Sph.'); 3 | 4 | function pj_goode(P) { 5 | var Y_COR = 0.05280, 6 | PHI_LIM = 0.71093078197902358062, 7 | sinuFwd, sinuInv, mollFwd, mollInv; 8 | P.es = 0; 9 | pj_sinu(P); 10 | sinuFwd = P.fwd; 11 | sinuInv = P.inv; 12 | pj_moll(P); 13 | mollFwd = P.fwd; 14 | mollInv = P.inv; 15 | P.fwd = function(lp, xy) { 16 | if (fabs(lp.phi) < PHI_LIM) { 17 | sinuFwd(lp, xy); 18 | } else { 19 | mollFwd(lp, xy); 20 | xy.y -= lp.phi > 0 ? Y_COR : -Y_COR; 21 | } 22 | }; 23 | P.inv = function(xy, lp) { 24 | if (fabs(xy.y) <= PHI_LIM) { 25 | sinuInv(xy, lp); 26 | } else { 27 | xy.y += xy.y > 0 ? Y_COR : -Y_COR; 28 | mollInv(xy, lp); 29 | } 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /src/projections/hammer.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | 3 | pj_add(pj_hammer, 'hammer', 'Hammer & Eckert-Greifendorff', 'Misc Sph,\nW= M='); 4 | 5 | function pj_hammer(P) { 6 | var w, m, rm; 7 | var EPS = 1e-10; 8 | P.inv = s_inv; 9 | P.fwd = s_fwd; 10 | P.es = 0; 11 | 12 | if (pj_param(P.params, "tW")) { 13 | if ((w = fabs(pj_param(P.params, "dW"))) <= 0) e_error(-27); 14 | } else 15 | w = 0.5; 16 | if (pj_param(P.params, "tM")) { 17 | if ((m = fabs(pj_param(P.params, "dM"))) <= 0) e_error(-27); 18 | } else 19 | m = 1; 20 | rm = 1 / m; 21 | m /= w; 22 | 23 | function s_fwd(lp, xy) { 24 | var cosphi, d; 25 | d = sqrt(2/(1 + (cosphi = cos(lp.phi)) * cos(lp.lam *= w))); 26 | xy.x = m * d * cosphi * sin(lp.lam); 27 | xy.y = rm * d * sin(lp.phi); 28 | } 29 | 30 | function s_inv(xy, lp) { 31 | var z = sqrt(1 - 0.25*w*w*xy.x*xy.x - 0.25*xy.y*xy.y); 32 | if (fabs(2*z*z-1) < EPS) { 33 | lp.lam = HUGE_VAL; 34 | lp.phi = HUGE_VAL; 35 | pj_errno = -14; 36 | } else { 37 | lp.lam = aatan2(w * xy.x * z,2 * z * z - 1)/w; 38 | lp.phi = aasin(z * xy.y); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/projections/hatano.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_hatano, 'hatano', 'Hatano Asymmetrical Equal Area', 'PCyl., Sph.'); 2 | 3 | function pj_hatano(P) { 4 | var NITER = 20; 5 | var EPS = 1e-7; 6 | var ONETOL = 1.000001; 7 | var CN = 2.67595; 8 | var CS = 2.43763; 9 | var RCN = 0.37369906014686373063; 10 | var RCS = 0.41023453108141924738; 11 | var FYCN = 1.75859; 12 | var FYCS = 1.93052; 13 | var RYCN = 0.56863737426006061674; 14 | var RYCS = 0.51799515156538134803; 15 | var FXC = 0.85; 16 | var RXC = 1.17647058823529411764; 17 | 18 | P.inv = s_inv; 19 | P.fwd = s_fwd; 20 | P.es = 0; 21 | 22 | function s_fwd(lp, xy) { 23 | var th1, c; 24 | var i; 25 | c = sin(lp.phi) * (lp.phi < 0 ? CS : CN); 26 | for (i = NITER; i; --i) { 27 | lp.phi -= th1 = (lp.phi + sin(lp.phi) - c) / (1 + cos(lp.phi)); 28 | if (fabs(th1) < EPS) break; 29 | } 30 | xy.x = FXC * lp.lam * cos(lp.phi *= 0.5); 31 | xy.y = sin(lp.phi) * (lp.phi < 0 ? FYCS : FYCN); 32 | } 33 | 34 | function s_inv(xy, lp) { 35 | var th = xy.y * (xy.y < 0 ? RYCS : RYCN); 36 | if (fabs(th) > 1) { 37 | if (fabs(th) > ONETOL) { 38 | i_error(); 39 | } else { 40 | th = th > 0 ? M_HALFPI : -M_HALFPI; 41 | } 42 | } else { 43 | th = asin(th); 44 | } 45 | 46 | lp.lam = RXC * xy.x / cos(th); 47 | th += th; 48 | lp.phi = (th + sin(th)) * (xy.y < 0 ? RCS : RCN); 49 | if (fabs(lp.phi) > 1) { 50 | if (fabs(lp.phi) > ONETOL) { 51 | i_error(); 52 | } else { 53 | lp.phi = lp.phi > 0 ? M_HALFPI : -M_HALFPI; 54 | } 55 | } else { 56 | lp.phi = asin(lp.phi); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/projections/latlong.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_lonlat, 'lonlat', 'Lat/long (Geodetic)', ''); 2 | pj_add(pj_lonlat, 'longlat', 'Lat/long (Geodetic alias)', ''); 3 | pj_add(pj_lonlat, 'latlon', 'Lat/long (Geodetic alias)', ''); 4 | pj_add(pj_lonlat, 'latlong', 'Lat/long (Geodetic alias)', ''); 5 | 6 | function pj_lonlat(P) { 7 | P.x0 = 0; 8 | P.y0 = 0; 9 | P.is_latlong = true; 10 | 11 | P.fwd = function(lp, xy) { 12 | xy.x = lp.lam / P.a; 13 | xy.y = lp.phi / P.a; 14 | }; 15 | 16 | P.inv = function(xy, lp) { 17 | lp.lam = xy.x * P.a; 18 | lp.phi = xy.y * P.a; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /src/projections/loxim.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_loxim, 'loxim', 'Loximuthal', 'PCyl Sph'); 2 | 3 | function pj_loxim(P) { 4 | var EPS = 1e-8; 5 | var phi1, cosphi1, tanphi1; 6 | phi1 = pj_param(P.params, "rlat_1"); 7 | cosphi1 = cos(phi1); 8 | tanphi1 = tan(M_FORTPI + 0.5 * phi1); 9 | if (cosphi1 < EPS) e_error(-22); 10 | P.fwd = s_fwd; 11 | P.inv = s_inv; 12 | P.es = 0; 13 | 14 | function s_fwd(lp, xy) { 15 | xy.y = lp.phi - phi1; 16 | if (fabs(xy.y) < EPS) 17 | xy.x = lp.lam * cosphi1; 18 | else { 19 | xy.x = M_FORTPI + 0.5 * lp.phi; 20 | if (fabs(xy.x) < EPS || fabs(fabs(xy.x) - M_HALFPI) < EPS) 21 | xy.x = 0; 22 | else 23 | xy.x = lp.lam * xy.y / log(tan(xy.x) / tanphi1); 24 | } 25 | } 26 | 27 | function s_inv(xy, lp) { 28 | lp.phi = xy.y + phi1; 29 | if (fabs(xy.y) < EPS) { 30 | lp.lam = xy.x / cosphi1; 31 | } else { 32 | lp.lam = M_FORTPI + 0.5 * lp.phi; 33 | if (fabs(lp.lam) < EPS || fabs(fabs(lp.lam) - M_HALFPI) < EPS) 34 | lp.lam = 0; 35 | else 36 | lp.lam = xy.x * log(tan(lp.lam) / tanphi1) / xy.y; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/projections/mbt_fpp.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_mbt_fpp, 'mbt_fpp', 'McBride-Thomas Flat-Polar Parabolic', 'Cyl., Sph.'); 2 | 3 | function pj_mbt_fpp(P) { 4 | var CS = 0.95257934441568037152, 5 | FXC = 0.92582009977255146156, 6 | FYC = 3.40168025708304504493, 7 | C23 = 2 / 3, 8 | C13 = 1 / 3, 9 | ONEEPS = 1.0000001; 10 | 11 | P.fwd = s_fwd; 12 | P.inv = s_inv; 13 | P.es = 0; 14 | 15 | function s_fwd(lp, xy) { 16 | lp.phi = asin(CS * sin(lp.phi)); 17 | xy.x = FXC * lp.lam * (2 * cos(C23 * lp.phi) - 1); 18 | xy.y = FYC * sin(C13 * lp.phi); 19 | } 20 | 21 | function s_inv(xy, lp) { 22 | lp.phi = xy.y / FYC; 23 | if (fabs(lp.phi) >= 1) { 24 | if (fabs(lp.phi) > ONEEPS) 25 | i_error(); 26 | else 27 | lp.phi = (lp.phi < 0) ? -M_HALFPI : M_HALFPI; 28 | } else 29 | lp.phi = asin(lp.phi); 30 | 31 | lp.lam = xy.x / (FXC * (2 * cos(C23 * (lp.phi *= 3)) - 1)); 32 | if (fabs(lp.phi = sin(lp.phi) / CS) >= 1) { 33 | if (fabs(lp.phi) > ONEEPS) 34 | i_error(); 35 | else 36 | lp.phi = (lp.phi < 0) ? -M_HALFPI : M_HALFPI; 37 | } else 38 | lp.phi = asin(lp.phi); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/projections/mbt_fpq.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_mbt_fpq, 'mbt_fpq', 'McBryde-Thomas Flat-Polar Quartic', 'Cyl., Sph.'); 2 | 3 | function pj_mbt_fpq(P) { 4 | var NITER = 20, 5 | EPS = 1e-7, 6 | ONETOL = 1.000001, 7 | C = 1.70710678118654752440, 8 | RC = 0.58578643762690495119, 9 | FYC = 1.87475828462269495505, 10 | RYC = 0.53340209679417701685, 11 | FXC = 0.31245971410378249250, 12 | RXC = 3.20041258076506210122; 13 | 14 | P.fwd = s_fwd; 15 | P.inv = s_inv; 16 | P.es = 0; 17 | 18 | function s_fwd(lp, xy) { 19 | var th1, c, i; 20 | c = C * sin(lp.phi); 21 | for (i = NITER; i; --i) { 22 | lp.phi -= th1 = (sin(0.5 * lp.phi) + sin(lp.phi) - c) / 23 | (0.5 * cos(0.5 * lp.phi) + cos(lp.phi)); 24 | if (fabs(th1) < EPS) break; 25 | } 26 | xy.x = FXC * lp.lam * (1.0 + 2 * cos(lp.phi) / cos(0.5 * lp.phi)); 27 | xy.y = FYC * sin(0.5 * lp.phi); 28 | } 29 | 30 | function s_inv(xy, lp) { 31 | var t; 32 | lp.phi = RYC * xy.y; 33 | if (fabs(lp.phi) > 1) { 34 | if (fabs(lp.phi) > ONETOL) i_error(); 35 | else if (lp.phi < 0) { 36 | t = -1; 37 | lp.phi = -M_PI; 38 | } else { 39 | t = 1; 40 | lp.phi = M_PI; 41 | } 42 | } else 43 | lp.phi = 2 * asin(t = lp.phi); 44 | lp.lam = RXC * xy.x / (1 + 2 * cos(lp.phi) / cos(0.5 * lp.phi)); 45 | lp.phi = RC * (t + sin(lp.phi)); 46 | if (fabs(lp.phi) > 1) 47 | if (fabs(lp.phi) > ONETOL) i_error(); 48 | else 49 | lp.phi = lp.phi < 0 ? -M_HALFPI : M_HALFPI; 50 | else 51 | lp.phi = asin(lp.phi); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/projections/mbt_fps.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | pj_add(pj_mbt_fps, 'mbt_fps', 'McBryde-Thomas Flat-Pole Sine (No. 2)', 'Cyl., Sph.'); 3 | 4 | function pj_mbt_fps(P) { 5 | var MAX_ITER = 10, 6 | LOOP_TOL = 1e-7, 7 | C1 = 0.45503, 8 | C2 = 1.36509, 9 | C3 = 1.41546, 10 | C_x = 0.22248, 11 | C_y = 1.44492, 12 | C1_2 = 1 / 3; 13 | 14 | P.fwd = s_fwd; 15 | P.inv = s_inv; 16 | P.es = 0; 17 | 18 | function s_fwd(lp, xy) { 19 | var k, V, t, i; 20 | k = C3 * sin(lp.phi); 21 | for (i = MAX_ITER; i; --i) { 22 | t = lp.phi / C2; 23 | lp.phi -= V = (C1 * sin(t) + sin(lp.phi) - k) / 24 | (C1_2 * cos(t) + cos(lp.phi)); 25 | if (fabs(V) < LOOP_TOL) 26 | break; 27 | } 28 | t = lp.phi / C2; 29 | xy.x = C_x * lp.lam * (1 + 3 * cos(lp.phi) / cos(t)); 30 | xy.y = C_y * sin(t); 31 | } 32 | 33 | function s_inv(xy, lp) { 34 | var t; 35 | lp.phi = C2 * (t = aasin(xy.y / C_y)); 36 | lp.lam = xy.x / (C_x * (1 + 3 * cos(lp.phi) / cos(t))); 37 | lp.phi = aasin((C1 * sin(t) + sin(lp.phi)) / C3); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/projections/mill.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_mill, 'mill', 'Miller Cylindrical', 'Cyl, Sph'); 2 | 3 | function pj_mill(P) { 4 | 5 | P.fwd = s_fwd; 6 | P.inv = s_inv; 7 | P.es = 0; 8 | 9 | function s_fwd(lp, xy) { 10 | xy.x = lp.lam; 11 | xy.y = log(tan(M_FORTPI + lp.phi * 0.4)) * 1.25; 12 | } 13 | 14 | function s_inv(xy, lp) { 15 | lp.lam = xy.x; 16 | lp.phi = 2.5 * (atan(exp(0.8 * xy.y)) - M_FORTPI); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/projections/nell.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_nell, 'nell', 'Nell', 'PCyl., Sph.'); 2 | 3 | function pj_nell(P) { 4 | var MAX_ITER = 10; 5 | var LOOP_TOL = 1e-7; 6 | P.inv = s_inv; 7 | P.fwd = s_fwd; 8 | P.es = 0; 9 | 10 | function s_fwd(lp, xy) { 11 | var k, V, i; 12 | k = 2 * sin(lp.phi); 13 | V = lp.phi * lp.phi; 14 | lp.phi *= 1.00371 + V * (-0.0935382 + V * -0.011412); 15 | for (i = MAX_ITER; i ; --i) { 16 | lp.phi -= V = (lp.phi + sin(lp.phi) - k) / 17 | (1 + cos(lp.phi)); 18 | if (fabs(V) < LOOP_TOL) 19 | break; 20 | } 21 | xy.x = 0.5 * lp.lam * (1 + cos(lp.phi)); 22 | xy.y = lp.phi; 23 | } 24 | 25 | function s_inv(xy, lp) { 26 | lp.lam = 2 * xy.x / (1 + cos(xy.y)); 27 | lp.phi = aasin(0.5 * (xy.y + sin(xy.y))); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/projections/nell_h.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_nell_h, 'nell_h', 'Nell-Hammer', 'PCyl., Sph.'); 2 | 3 | function pj_nell_h(P) { 4 | var NITER = 9, 5 | EPS = 1e-7; 6 | P.es = 0; 7 | P.fwd = s_fwd; 8 | P.inv = s_inv; 9 | 10 | function s_fwd(lp, xy) { 11 | xy.x = 0.5 * lp.lam * (1 + cos(lp.phi)); 12 | xy.y = 2.0 * (lp.phi - tan(0.5 *lp.phi)); 13 | } 14 | 15 | function s_inv(xy, lp) { 16 | var V, c, p, i; 17 | p = 0.5 * xy.y; 18 | for (i = NITER; i>0; --i) { 19 | c = cos(0.5 * lp.phi); 20 | lp.phi -= V = (lp.phi - tan(lp.phi/2) - p)/(1 - 0.5/(c*c)); 21 | if (fabs(V) < EPS) 22 | break; 23 | } 24 | if (!i) { 25 | lp.phi = p < 0 ? -M_HALFPI : M_HALFPI; 26 | lp.lam = 2 * xy.x; 27 | } else 28 | lp.lam = 2 * xy.x / (1 + cos(lp.phi)); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/projections/patterson.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_patterson, 'patterson', 'Patterson Cylindrical', 'Cyl., Sph.'); 2 | 3 | function pj_patterson(P) { 4 | var K1 = 1.0148, 5 | K2 = 0.23185, 6 | K3 = -0.14499, 7 | K4 = 0.02406, 8 | C1 = K1, 9 | C2 = (5.0 * K2), 10 | C3 = (7.0 * K3), 11 | C4 = (9.0 * K4), 12 | EPS = 1e-11, 13 | MAX_Y = 908571831.7; 14 | 15 | P.es = 0; 16 | P.fwd = s_fwd; 17 | P.inv = s_inv; 18 | 19 | function s_fwd(lp, xy) { 20 | var phi2 = lp.phi * lp.phi; 21 | xy.x = lp.lam; 22 | xy.y = lp.phi * (K1 + phi2 * phi2 * (K2 + phi2 * (K3 + K4 * phi2))); 23 | } 24 | 25 | function s_inv(xy, lp) { 26 | var MAX_ITER = 100; 27 | var yc, tol, y2, f, fder; 28 | var i; 29 | 30 | yc = xy.y; 31 | 32 | /* make sure y is inside valid range */ 33 | if (xy.y > MAX_Y) { 34 | xy.y = MAX_Y; 35 | } else if (xy.y < -MAX_Y) { 36 | xy.y = -MAX_Y; 37 | } 38 | 39 | for (i = MAX_ITER; i ; --i) { /* Newton-Raphson */ 40 | y2 = yc * yc; 41 | f = (yc * (K1 + y2 * y2 * (K2 + y2 * (K3 + K4 * y2)))) - xy.y; 42 | fder = C1 + y2 * y2 * (C2 + y2 * (C3 + C4 * y2)); 43 | yc -= tol = f / fder; 44 | if (fabs(tol) < EPS) { 45 | break; 46 | } 47 | } 48 | // other projections don't error if non-convergent 49 | // if (i === 0) error(PJD_ERR_NON_CONVERGENT); 50 | lp.phi = yc; 51 | 52 | /* longitude */ 53 | lp.lam = xy.x; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/projections/putp2.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | 3 | pj_add(pj_putp2, 'putp2', 'Putnins P2', 'PCyl., Sph.'); 4 | 5 | function pj_putp2(P) { 6 | var C_x = 1.89490, 7 | C_y = 1.71848, 8 | C_p = 0.6141848493043784, 9 | EPS = 1e-10, 10 | NITER = 10, 11 | PI_DIV_3 = 1.0471975511965977; 12 | P.es = 0; 13 | P.fwd = s_fwd; 14 | P.inv = s_inv; 15 | 16 | function s_fwd(lp, xy) { 17 | var p, c, s, V, i; 18 | p = C_p * sin(lp.phi); 19 | s = lp.phi * lp.phi; 20 | lp.phi *= 0.615709 + s * ( 0.00909953 + s * 0.0046292 ); 21 | for (i = NITER; i ; --i) { 22 | c = cos(lp.phi); 23 | s = sin(lp.phi); 24 | lp.phi -= V = (lp.phi + s * (c - 1) - p) / 25 | (1 + c * (c - 1) - s * s); 26 | if (fabs(V) < EPS) 27 | break; 28 | } 29 | if (!i) 30 | lp.phi = lp.phi < 0 ? - PI_DIV_3 : PI_DIV_3; 31 | xy.x = C_x * lp.lam * (cos(lp.phi) - 0.5); 32 | xy.y = C_y * sin(lp.phi); 33 | } 34 | 35 | function s_inv(xy, lp) { 36 | var c; 37 | lp.phi = aasin(xy.y / C_y); 38 | lp.lam = xy.x / (C_x * ((c = cos(lp.phi)) - 0.5)); 39 | lp.phi = aasin((lp.phi + sin(lp.phi) * (c - 1)) / C_p); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/projections/putp3.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | 3 | pj_add(pj_putp3, 'putp3', 'Putnins P3', 'PCyl., Sph.'); 4 | pj_add(pj_putp3p, 'putp3p', 'Putnins P3\'', 'PCyl., Sph.'); 5 | 6 | function pj_putp3p(P) { 7 | pj_putp3(P, true); 8 | } 9 | 10 | function pj_putp3(P, prime) { 11 | var C = 0.79788456, 12 | RPISQ = 0.1013211836, 13 | A = (prime ? 2 : 4) * RPISQ; 14 | P.es = 0; 15 | P.fwd = s_fwd; 16 | P.inv = s_inv; 17 | 18 | function s_fwd(lp, xy) { 19 | xy.x = C * lp.lam * (1 - A * lp.phi * lp.phi); 20 | xy.y = C * lp.phi; 21 | } 22 | 23 | function s_inv(xy, lp) { 24 | lp.phi = xy.y / C; 25 | lp.lam = xy.x / (C * (1 - A * lp.phi * lp.phi)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/projections/putp4p.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | 3 | pj_add(pj_putp4p, 'putp4p', 'Putnins P4\'', 'PCyl., Sph.'); 4 | pj_add(pj_weren, 'weren', 'Werenskiold I', 'PCyl., Sph.'); 5 | 6 | function pj_putp4p(P) { 7 | pj_putp4p_init(P, 0.874038744, 3.883251825); 8 | } 9 | 10 | function pj_weren(P) { 11 | pj_putp4p_init(P, 1, 4.442882938); 12 | } 13 | 14 | function pj_putp4p_init(P, C_x, C_y) { 15 | P.es = 0; 16 | P.fwd = s_fwd; 17 | P.inv = s_inv; 18 | 19 | function s_fwd(lp, xy) { 20 | lp.phi = aasin(0.883883476 * sin(lp.phi)); 21 | xy.x = C_x * lp.lam * cos(lp.phi); 22 | xy.x /= cos(lp.phi *= 0.333333333333333); 23 | xy.y = C_y * sin(lp.phi); 24 | } 25 | 26 | function s_inv(xy, lp) { 27 | lp.phi = aasin(xy.y / C_y); 28 | lp.lam = xy.x * cos(lp.phi) / C_x; 29 | lp.phi *= 3; 30 | lp.lam /= cos(lp.phi); 31 | lp.phi = aasin(1.13137085 * sin(lp.phi)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/projections/putp5.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | 3 | pj_add(pj_putp5, 'putp5', 'Putnins P5', 'PCyl., Sph.'); 4 | pj_add(pj_putp5p, 'putp5p', 'Putnins P5\'', 'PCyl., Sph.'); 5 | 6 | function pj_putp5p(P) { 7 | pj_putp5(P, true); 8 | } 9 | 10 | function pj_putp5(P, prime) { 11 | var A = (prime ? 1.5 : 2), 12 | B = (prime ? 0.5 : 1), 13 | C = 1.01346, 14 | D = 1.2158542; 15 | 16 | P.es = 0; 17 | P.fwd = s_fwd; 18 | P.inv = s_inv; 19 | 20 | function s_fwd(lp, xy) { 21 | xy.x = C * lp.lam * (A - B * sqrt(1 + D * lp.phi * lp.phi)); 22 | xy.y = C * lp.phi; 23 | } 24 | 25 | function s_inv(xy, lp) { 26 | lp.phi = xy.y / C; 27 | lp.lam = xy.x / (C * (A - B * sqrt(1 + D * lp.phi * lp.phi))); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/projections/putp6.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | 3 | pj_add(pj_putp6, 'putp6', 'Putnins P6', 'PCyl., Sph.'); 4 | pj_add(pj_putp6p, 'putp6p', 'Putnins P6\'', 'PCyl., Sph.'); 5 | 6 | function pj_putp6p(P) { 7 | pj_putp6(P, true); 8 | } 9 | 10 | function pj_putp6(P, prime) { 11 | var EPS = 1e-10, 12 | NITER = 10, 13 | CON_POLE = 1.732050807568877, 14 | A, B, C_x, C_y, D; 15 | 16 | if (prime) { 17 | C_x = 0.44329; 18 | C_y = 0.80404; 19 | A = 6; 20 | B = 5.61125; 21 | D = 3; 22 | } else { 23 | C_x = 1.01346; 24 | C_y = 0.91910; 25 | A = 4; 26 | B = 2.1471437182129378784; 27 | D = 2; 28 | } 29 | 30 | P.es = 0; 31 | P.fwd = s_fwd; 32 | P.inv = s_inv; 33 | 34 | function s_fwd(lp, xy) { 35 | var p, r, V, i; 36 | p = B * sin(lp.phi); 37 | lp.phi *= 1.10265779; 38 | for (i = NITER; i ; --i) { 39 | r = sqrt(1 + lp.phi * lp.phi); 40 | lp.phi -= V = ( (A - r) * lp.phi - log(lp.phi + r) - p ) / 41 | (A - 2 * r); 42 | if (fabs(V) < EPS) 43 | break; 44 | } 45 | if (!i) 46 | lp.phi = p < 0 ? -CON_POLE : CON_POLE; 47 | xy.x = C_x * lp.lam * (D - sqrt(1 + lp.phi * lp.phi)); 48 | xy.y = C_y * lp.phi; 49 | } 50 | 51 | function s_inv(xy, lp) { 52 | var r; 53 | lp.phi = xy.y / C_y; 54 | r = sqrt(1 + lp.phi * lp.phi); 55 | lp.lam = xy.x / (C_x * (D - r)); 56 | lp.phi = aasin(((A - r) * lp.phi - log(lp.phi + r)) / B); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/projections/sterea.js: -------------------------------------------------------------------------------- 1 | /* @requires pj_gauss */ 2 | 3 | pj_add(pj_sterea, 'sterea', 'Oblique Stereographic Alternative', 'Azimuthal, Sph&Ell'); 4 | 5 | function pj_sterea(P) { 6 | var en = pj_gauss_ini(P.e, P.phi0), 7 | phic0 = en.chi, 8 | R = en.rc, 9 | R2 = 2 * R, 10 | sinc0 = sin(phic0), 11 | cosc0 = cos(phic0); 12 | 13 | P.fwd = e_fwd; 14 | P.inv = e_inv; 15 | 16 | function e_fwd(lp, xy) { 17 | var cosc, sinc, cosl, k; 18 | lp = pj_gauss(lp, en); 19 | sinc = sin(lp.phi); 20 | cosc = cos(lp.phi); 21 | cosl = cos(lp.lam); 22 | k = P.k0 * R2 / (1 + sinc0 * sinc + cosc0 * cosc * cosl); 23 | xy.x = k * cosc * sin(lp.lam); 24 | xy.y = k * (cosc0 * sinc - sinc0 * cosc * cosl); 25 | } 26 | 27 | function e_inv(xy, lp) { 28 | var x = xy.x / P.k0, 29 | y = xy.y / P.k0, 30 | rho, c, sinc, cosc; 31 | if ((rho = hypot(x, y))) { 32 | c = 2 * atan2(rho, R2); 33 | sinc = sin(c); 34 | cosc = cos(c); 35 | lp.phi = asin(cosc * sinc0 + y * sinc * cosc0 / rho); 36 | lp.lam = atan2(x * sinc, rho * cosc0 * cosc - y * sinc0 * sinc); 37 | } else { 38 | lp.phi = phic0; 39 | lp.lam = 0; 40 | } 41 | pj_inv_gauss(lp, en); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/projections/sts.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | 3 | pj_add(pj_kav5, 'kav5', 'Kavraisky V', 'PCyl., Sph.'); 4 | pj_add(pj_qua_aut, 'qua_aut', 'Quartic Authalic', 'PCyl., Sph.'); 5 | pj_add(pj_fouc, 'fouc', 'Foucaut', 'PCyl., Sph.'); 6 | pj_add(pj_mbt_s, 'mbt_s', 'McBryde-Thomas Flat-Polar Sine (No. 1)', 'PCyl., Sph.'); 7 | 8 | function pj_kav5(P) { 9 | pj_sts(P, 1.50488, 1.35439, false); 10 | } 11 | 12 | function pj_qua_aut(P) { 13 | pj_sts(P, 2, 2, false); 14 | } 15 | 16 | function pj_fouc(P) { 17 | pj_sts(P, 2, 2, true); 18 | } 19 | 20 | function pj_mbt_s(P) { 21 | pj_sts(P, 1.48875, 1.36509, false); 22 | } 23 | 24 | function pj_sts(P, p, q, tan_mode) { 25 | var C_x = q / p; 26 | var C_y = p; 27 | var C_p = 1 / q; 28 | P.inv = s_inv; 29 | P.fwd = s_fwd; 30 | P.es = 0; 31 | 32 | function s_fwd(lp, xy) { 33 | var c; 34 | xy.x = C_x * lp.lam * cos(lp.phi); 35 | xy.y = C_y; 36 | lp.phi *= C_p; 37 | c = cos(lp.phi); 38 | if (tan_mode) { 39 | xy.x *= c * c; 40 | xy.y *= tan(lp.phi); 41 | } else { 42 | xy.x /= c; 43 | xy.y *= sin (lp.phi); 44 | } 45 | } 46 | 47 | function s_inv(xy, lp) { 48 | var c; 49 | xy.y /= C_y; 50 | c = cos (lp.phi = tan_mode ? atan(xy.y) : aasin(xy.y)); 51 | lp.phi /= C_p; 52 | lp.lam = xy.x / (C_x * cos(lp.phi)); 53 | if (tan_mode) 54 | lp.lam /= c * c; 55 | else 56 | lp.lam *= c; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/projections/tcea.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_tcea, 'tcea', 'Transverse Cylindrical Equal Area', 'Cyl, Sph'); 2 | 3 | function pj_tcea(P) { 4 | P.es = 0; 5 | P.fwd = s_fwd; 6 | P.inv = s_inv; 7 | 8 | function s_fwd(lp, xy) { 9 | xy.x = cos (lp.phi) * sin (lp.lam) / P.k0; 10 | xy.y = P.k0 * (atan2 (tan (lp.phi), cos (lp.lam)) - P.phi0); 11 | } 12 | 13 | function s_inv(xy, lp) { 14 | var t; 15 | xy.y = xy.y / P.k0 + P.phi0; 16 | xy.x *= P.k0; 17 | t = sqrt (1 - xy.x * xy.x); 18 | lp.phi = asin (t * sin (xy.y)); 19 | lp.lam = atan2 (xy.x, t * cos (xy.y)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/projections/times.js: -------------------------------------------------------------------------------- 1 | pj_add(pj_times, 'times', 'Times', 'Cyl, Sph'); 2 | 3 | function pj_times(P) { 4 | P.es = 0; 5 | P.fwd = function(lp, xy) { 6 | var t = tan(lp.phi / 2); 7 | var s = sin(M_FORTPI * t); 8 | xy.x = lp.lam * (0.74482 - 0.34588 * s * s); 9 | xy.y = 1.70711 * t; 10 | }; 11 | P.inv = function (xy, lp) { 12 | var t = xy.y / 1.70711; 13 | var s = sin(M_FORTPI * t); 14 | lp.lam = xy.x / (0.74482 - 0.34588 * s * s); 15 | lp.phi = 2 * atan(t); 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /src/projections/urm5.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | 3 | pj_add(pj_urm5, 'urm5', 'Urmaev V', 'PCyl., Sph., no inv.\nn= q= alpha='); 4 | 5 | function pj_urm5(P) { 6 | var m, rmn, q3, n; 7 | var alpha, t; 8 | n = pj_param(P.params, "dn"); 9 | if (n > 0 && n <= 1 === false) { 10 | e_error(-40); 11 | } 12 | q3 = pj_param(P.params, "dq") / 3; 13 | alpha = pj_param(P.params, "ralpha"); 14 | t = n * sin (alpha); 15 | m = cos (alpha) / sqrt (1 - t * t); 16 | rmn = 1 / (m * n); 17 | 18 | P.fwd = s_fwd; 19 | P.es = 0; 20 | 21 | function s_fwd(lp, xy) { 22 | var t = lp.phi = aasin (n * sin (lp.phi)); 23 | xy.x = m * lp.lam * cos (lp.phi); 24 | t *= t; 25 | xy.y = lp.phi * (1 + t * q3) * rmn; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/projections/urmfps.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | 3 | pj_add(pj_urmfps, 'urmfps', 'Urmaev Flat-Polar Sinusoidal', 'PCyl, Sph.\nn='); 4 | pj_add(pj_wag1, 'wag1', 'Wagner I (Kavraisky VI)', 'PCyl, Sph.'); 5 | 6 | 7 | function pj_wag1(P) { 8 | pj_urmfps_init(P, 0.8660254037844386467637231707); 9 | } 10 | 11 | function pj_urmfps(P) { 12 | var n = pj_param(P.params, "dn"); 13 | if (n <= 0 || n > 1) e_error(-40); 14 | pj_urmfps_init(P, n); 15 | } 16 | 17 | function pj_urmfps_init(P, n) { 18 | var C_x = 0.8773826753, 19 | C_y = 1.139753528477 / n; 20 | 21 | P.es = 0; 22 | P.fwd = s_fwd; 23 | P.inv = s_inv; 24 | 25 | function s_fwd(lp, xy) { 26 | var phi = aasin(n * sin(lp.phi)); 27 | xy.x = C_x * lp.lam * cos(phi); 28 | xy.y = C_y * phi; 29 | } 30 | 31 | function s_inv(xy, lp) { 32 | xy.y /= C_y; 33 | lp.phi = aasin(sin(xy.y) / n); 34 | lp.lam = xy.x / (C_x * cos(xy.y)); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/projections/wag.js: -------------------------------------------------------------------------------- 1 | /* @requires aasincos */ 2 | 3 | pj_add(pj_wag2, 'wag2', 'Wagner II', 'PCyl., Sph.'); 4 | pj_add(pj_wag3, 'wag3', 'Wagner III', 'PCyl., Sph.\nlat_ts='); 5 | pj_add(pj_wag7, 'wag7', 'Wagner VII', 'Misc Sph, no inv.'); 6 | 7 | function pj_wag2(P) { 8 | var C_x = 0.92483, 9 | C_y = 1.38725, 10 | C_p1 = 0.88022, 11 | C_p2 = 0.88550; 12 | 13 | P.fwd = s_fwd; 14 | P.inv = s_inv; 15 | 16 | function s_fwd(lp, xy) { 17 | lp.phi = aasin(C_p1 * sin (C_p2 * lp.phi)); 18 | xy.x = C_x * lp.lam * cos (lp.phi); 19 | xy.y = C_y * lp.phi; 20 | } 21 | 22 | function s_inv(xy, lp) { 23 | lp.phi = xy.y / C_y; 24 | lp.lam = xy.x / (C_x * cos(lp.phi)); 25 | lp.phi = aasin(sin(lp.phi) / C_p1) / C_p2; 26 | } 27 | } 28 | 29 | function pj_wag3(P) { 30 | var TWOTHIRD = 0.6666666666666666666667, 31 | ts = pj_param(P.params, "rlat_ts"), 32 | C_x = cos(ts) / cos(2*ts/3); 33 | 34 | P.es = 0; 35 | P.fwd = s_fwd; 36 | P.inv = s_inv; 37 | 38 | function s_fwd(lp, xy) { 39 | xy.x = C_x * lp.lam * cos(TWOTHIRD * lp.phi); 40 | xy.y = lp.phi; 41 | } 42 | 43 | function s_inv(xy, lp) { 44 | lp.phi = xy.y; 45 | lp.lam = xy.x / (C_x * cos(TWOTHIRD * lp.phi)); 46 | } 47 | } 48 | 49 | function pj_wag7(P) { 50 | P.es = 0; 51 | P.fwd = function(lp, xy) { 52 | var theta, ct, D; 53 | theta = asin (xy.y = 0.90630778703664996 * sin(lp.phi)); 54 | xy.x = 2.66723 * (ct = cos (theta)) * sin (lp.lam /= 3); 55 | xy.y *= 1.24104 * (D = 1/(sqrt (0.5 * (1 + ct * cos(lp.lam))))); 56 | xy.x *= D; 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /src/projections/wink.js: -------------------------------------------------------------------------------- 1 | 2 | pj_add(pj_wink1, 'wink1', 'Winkel I', 'PCyl., Sph.\nlat_ts='); 3 | pj_add(pj_wink2, 'wink2', 'Winkel II', 'PCyl., Sph., no inv.\nlat_1='); 4 | 5 | function pj_wink1(P) { 6 | var cosphi1 = cos(pj_param(P.params, "rlat_ts")); 7 | P.fwd = s_fwd; 8 | P.inv = s_inv; 9 | P.es = 0; 10 | 11 | function s_fwd(lp, xy) { 12 | xy.x = 0.5 * lp.lam * (cosphi1 + cos(lp.phi)); 13 | xy.y = lp.phi; 14 | } 15 | 16 | function s_inv(xy, lp) { 17 | lp.phi = xy.y; 18 | lp.lam = 2 * xy.x / (cosphi1 + cos(lp.phi)); 19 | } 20 | } 21 | 22 | function pj_wink2(P) { 23 | var cosphi1 = cos(pj_param(P.params, "rlat_1")); 24 | var MAX_ITER = 10, 25 | LOOP_TOL = 1e-7; 26 | P.fwd = s_fwd; 27 | P.inv = null; 28 | P.es = 0; 29 | 30 | function s_fwd(lp, xy) { 31 | var k, V, i, phi = lp.phi; 32 | xy.y = phi * M_TWO_D_PI; 33 | k = M_PI * sin(phi); 34 | phi *= 1.8; 35 | for (i = MAX_ITER; i ; --i) { 36 | phi -= V = (phi + sin (phi) - k) / 37 | (1 + cos(phi)); 38 | if (fabs(V) < LOOP_TOL) 39 | break; 40 | } 41 | if (!i) 42 | phi = (phi < 0) ? -M_HALFPI : M_HALFPI; 43 | else 44 | phi *= 0.5; 45 | xy.x = 0.5 * lp.lam * (cos(phi) + cosphi1); 46 | xy.y = M_FORTPI * (sin(phi) + xy.y); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/rtodms.js: -------------------------------------------------------------------------------- 1 | /* @requires pj_const */ 2 | 3 | 4 | function get_rtodms(decimals, fixedWidth, pos, neg) { 5 | var dtodms = get_dtodms(decimals, fixedWidth, pos, neg); 6 | return function(r) { 7 | return dtodms(r * RAD_TO_DEG); 8 | }; 9 | } 10 | 11 | // returns function for formatting as DMS 12 | // See Proj.4 rtodms.c 13 | // @pos: 'N' or 'E' 14 | // @neg: 'S' or 'W' 15 | function get_dtodms(decimals, fixedWidth, pos, neg) { 16 | var RES, CONV, i; 17 | if (decimals < 0 || decimals >= 9) { 18 | decimals = 3; 19 | } 20 | RES = 1; 21 | for (i=0; i -1; 21 | }; 22 | } 23 | 24 | function get_simple_maker_test(projId) { 25 | return function(P) { 26 | var id = get_proj_id(P); 27 | return id && id == projId; 28 | }; 29 | } 30 | 31 | function add_wkt_parser(is_match, parse) { 32 | if (typeof is_match != 'function') wkt_error("Missing WKT parser test"); 33 | if (typeof parse != 'function') wkt_error("Missing WKT parse function"); 34 | wkt_parsers.push([is_match, parse]); 35 | } 36 | 37 | function add_wkt_maker(is_match, make) { 38 | if (typeof is_match != 'function') wkt_error("Missing WKT maker test"); 39 | if (typeof make != 'function') wkt_error("Missing WKT maker function"); 40 | wkt_makers.push([is_match, make]); 41 | } 42 | -------------------------------------------------------------------------------- /src/wkt/wkt_axis.js: -------------------------------------------------------------------------------- 1 | 2 | // TODO: translate between proj4 +axis and wkt AXIS parameters 3 | 4 | // get array of AXIS attributes 5 | // TODO: use this function; support non-standard axes 6 | function wkt_get_axis(P) { 7 | var x = ['AXIS', 'Easting', 'EAST']; 8 | var y = ['AXIS', 'Northing', 'NORTH']; 9 | return [x, y]; 10 | } 11 | -------------------------------------------------------------------------------- /src/wkt/wkt_convert_projcs.js: -------------------------------------------------------------------------------- 1 | /* @requires 2 | wkt_common 3 | wkt_unit 4 | wkt_convert_geogcs 5 | */ 6 | 7 | // Converts a PROJCS WKT in object format to a Proj.4 string 8 | // Throws an Error if unable to convert 9 | function wkt_convert_projcs(projcs) { 10 | return find_wkt_parser(projcs)(projcs); 11 | } 12 | 13 | function wkt_simple_projcs_converter(projId, paramIds) { 14 | return wkt_projcs_converter({ 15 | PROJECTION: wkt_simple_projection_converter(projId), 16 | PARAMETER: wkt_parameter_converter(paramIds) 17 | }); 18 | } 19 | 20 | function wkt_simple_projection_converter(id) { 21 | return function() {return '+proj=' + id;}; 22 | } 23 | 24 | function wkt_projcs_converter(o) { 25 | return function(projcs) { 26 | var projStr = o.PROJECTION(projcs); 27 | var paramStr = o.PARAMETER(projcs); 28 | var geogStr = o.GEOGCS ? o.GEOGCS(projcs) : wkt_convert_geogcs(projcs.GEOGCS); 29 | var unitStr = wkt_convert_unit(projcs); 30 | return [projStr, paramStr, geogStr, unitStr, '+no_defs'].filter(function(s) {return !!s;}).join(' '); 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /src/wkt/wkt_fallback.js: -------------------------------------------------------------------------------- 1 | 2 | // Fallback WKT definitions include a Proj.4 string in an EXTENSION property. 3 | // They should be readable by QGIS and gdal/ogr, but will not work 4 | // with most other GIS software. 5 | 6 | function get_fallback_wkt_maker(P) { 7 | // TODO: validate P? 8 | return make_fallback_wkt; 9 | } 10 | 11 | function make_fallback_wkt(P) { 12 | var projName = P.proj in pj_list ? pj_list[P.proj].name : ''; 13 | var proj4 = get_proj_defn(P); 14 | var geogcs = wkt_make_geogcs(P); 15 | // GDAL seems to use "unnamed" all the time 16 | var name = projName ? geogcs.NAME + ' / ' + projName : 'unnamed'; 17 | return {PROJCS: { 18 | NAME: name, 19 | GEOGCS: geogcs, 20 | PROJECTION: 'custom_proj4', 21 | PARAMETER: [], 22 | UNIT: wkt_make_unit(P), 23 | EXTENSION: ['PROJ4', proj4 + ' +wktext'] 24 | }}; 25 | } 26 | 27 | function get_fallback_wkt_parser(projcs) { 28 | var proj4 = get_proj4_from_extension(projcs); 29 | // TODO: try parsing proj4 string to validate? 30 | return proj4 ? get_proj4_from_extension : null; 31 | } 32 | 33 | function get_proj4_from_extension(projcs) { 34 | var ext = projcs.EXTENSION; 35 | if (ext && ext[0] == 'PROJ4') { 36 | return (ext[1] || '').replace(' +wktext', ''); 37 | } 38 | return null; 39 | } 40 | -------------------------------------------------------------------------------- /src/wkt/wkt_make_projcs.js: -------------------------------------------------------------------------------- 1 | /* @requires wkt_make_geogcs */ 2 | 3 | // Converts a Proj object to a WKT in object format 4 | function wkt_make_projcs(P) { 5 | return find_wkt_maker(P)(P); 6 | } 7 | 8 | function wkt_simple_projcs_maker(wktProjection, paramIds) { 9 | return wkt_projcs_maker({ 10 | PROJECTION: wktProjection, 11 | PARAMETER: wkt_parameter_maker(paramIds) 12 | }); 13 | } 14 | 15 | function wkt_projcs_maker(o) { 16 | return function(P) { 17 | var projcs = { 18 | // if o.NAME GEOGCS exists and returns falsy value, use default function 19 | GEOGCS: o.GEOGCS && o.GEOGCS(P) || wkt_make_geogcs(P), 20 | PROJECTION: wkt_is_string(o.PROJECTION) ? o.PROJECTION : o.PROJECTION(P), 21 | PARAMETER: o.PARAMETER(P), 22 | UNIT: wkt_make_unit(P) 23 | }; 24 | // if o.NAME function exists and returns falsy value, use default name 25 | projcs.NAME = o.NAME && o.NAME(P, projcs) || wkt_make_default_projcs_name(P, projcs); 26 | return {PROJCS: projcs}; 27 | }; 28 | } 29 | 30 | // Get CS name from comment in +init source (if +init param is present) 31 | function wkt_get_init_name(P) { 32 | var o; 33 | if (pj_param(P.params, 'tinit')) { 34 | o = pj_read_init_opts(pj_param(P.params, 'sinit')); 35 | } 36 | return o ? o.comment : ''; 37 | } 38 | 39 | function wkt_make_default_projcs_name(P, projcs) { 40 | var initName = wkt_get_init_name(P); 41 | return initName || projcs.GEOGCS.NAME + ' / ' + projcs.PROJECTION; 42 | } 43 | -------------------------------------------------------------------------------- /src/wkt/wkt_unit.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | function wkt_get_unit_defn(projcs) { 4 | // TODO: consider using unit names 5 | return { 6 | to_meter: projcs.UNIT[1] 7 | }; 8 | } 9 | 10 | function wkt_convert_unit(PROJCS) { 11 | var defn = wkt_get_unit_defn(PROJCS); 12 | var proj4 = ""; 13 | if (defn.to_meter != 1) { 14 | proj4 = '+to_meter=' + defn.to_meter; 15 | } else if (!WKT_OMIT_DEFAULTS) { 16 | proj4 = '+units=m'; 17 | } 18 | return proj4; 19 | } 20 | 21 | function wkt_make_unit(P) { 22 | return ['Meter', P.to_meter || 1]; 23 | } 24 | 25 | /* 26 | // OLD -- merge into wkt_make_unit() 27 | function wkt_get_unit(P) { 28 | var defn = pj_find_units_by_value(P.to_meter); 29 | var name = defn ? defn.name : 'Unknown'; 30 | return ['UNIT', name, P.to_meter]; 31 | } 32 | */ 33 | -------------------------------------------------------------------------------- /test/api_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | mproj = require('../'); 3 | 4 | describe('api tests', function() { 5 | 6 | it('returns itself when module function is called with non-string arguments', function() { 7 | // (For compatibility with Webpack's require function) 8 | assert.equal(mproj(), mproj); 9 | }) 10 | 11 | }); 12 | -------------------------------------------------------------------------------- /test/cli_lib_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | lib = require('../src/cli/cli_lib'); 3 | 4 | describe('cli_lib.js', function () { 5 | describe('-f formatting', function () { 6 | 7 | function test(fmt, val, expect) { 8 | it (fmt + ' ' + val + ' -> ' + expect, function() { 9 | var f = lib.get_dfmt(fmt); 10 | var str = f(val); 11 | assert.equal(str, expect); 12 | }); 13 | } 14 | 15 | // type f/F 16 | test('%f', 200, '200.000000'); 17 | test('%08.1F', 200.12, '000200.1'); 18 | test('%+08.1f', 200.12, '+00200.1'); 19 | test('%-8.1f', 200.12, '200.1 '); 20 | test('%-+8.1f', 200.12, '+200.1 '); 21 | test('%-+8.1f', -200.12, '-200.1 '); 22 | test('%010.1f', 123456789, '123456789.0'); 23 | test('%011.1f', 123456789, '123456789.0'); 24 | test('%012.1f', 123456789, '0123456789.0'); 25 | test('%+12.1f', 123456789, '+123456789.0'); 26 | test('%12.1f', 123456789, ' 123456789.0'); 27 | 28 | // NAN 29 | test('%12.1f', NaN, 'nan'); 30 | test('%12.1F', NaN, 'NAN'); 31 | 32 | // type e/E 33 | test('%e', 0, '0.000000e+0'); 34 | test('%E', 0, '0.000000E+0'); 35 | test('%010.3e', -0.00023, '-02.300e-4'); 36 | 37 | }) 38 | }) 39 | -------------------------------------------------------------------------------- /test/debug_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../'), 3 | helpers = require('./helpers'), 4 | cs2cs = require('../bin/mcs2cs'), 5 | proj = require('../bin/mproj'); 6 | 7 | describe('debug', function () { 8 | it ('-f %.6f', function() { 9 | var expect = '-556597.453966\t-553583.846816'; 10 | var output = proj('-f %.6f +proj=merc +datum=WGS84')('5dW 5dS'); 11 | // console.log(output) 12 | // assert.equal(output, expect); 13 | }) 14 | }) -------------------------------------------------------------------------------- /test/dmstor_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | helpers = require('./helpers'), 3 | api = require('../'); 4 | 5 | function test(str, val) { 6 | it(str, function() { 7 | var output = api.internal.dmstod(str); 8 | helpers.aboutEqual(output, val); 9 | }); 10 | } 11 | 12 | describe('dmstor.js', function () { 13 | // examples from http://proj.maptools.org/gen_parms.html 14 | test('0dE', 0); 15 | test('9d07\'54.862"W', -9.131906111111112); 16 | test('12d27\'8.4"E', 12.452333333333332); 17 | test('12d27\'8.4E', 12.452333333333332); // omit " 18 | test('17d40\'s', -17.666666666666667); 19 | test('17d40s', -17.666666666666667); // omit ' 20 | test('-10.03', -10.03); 21 | test('0.02', 0.02); 22 | test('0', 0); 23 | }) 24 | -------------------------------------------------------------------------------- /test/gigs/5101.2-jhs.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[-2.0, 80.0], [403186.945, 8885748.708]], 4 | [[-2.0, 60.0], [221288.77, 6661953.041]], 5 | [[-2.0, 40.0], [73106.698, 4439746.917]], 6 | [[-2.0, 20.0], [-23538.687, 2219308.238]], 7 | [[-2.0, 0.0], [-57087.12, 0.0]], 8 | [[-2.0, -20.0], [-23538.687, -2219308.238]], 9 | [[-2.0, -40.0], [73106.698, -4439746.917]], 10 | [[-2.0, -60.0], [221288.77, -6661953.041]], 11 | [[-2.0, -80.0], [403186.945, -8885748.708]], 12 | [[-5.0, 60.0], [54506.435, 6678411.623]], 13 | [[-4.0, 60.0], [110043.299, 6672079.494]], 14 | [[-3.0, 60.0], [165640.332, 6666593.572]], 15 | [[-2.0, 60.0], [221288.77, 6661953.041]], 16 | [[-1.0, 60.0], [276979.926, 6658157.202]], 17 | [[0.0, 60.0], [332705.179, 6655205.484]], 18 | [[1.0, 60.0], [388455.958, 6653097.435]], 19 | [[2.0, 60.0], [444223.733, 6651832.735]], 20 | [[3.0, 60.0], [500000.0, 6651411.19]], 21 | [[4.0, 60.0], [555776.267, 6651832.735]], 22 | [[5.0, 60.0], [611544.042, 6653097.435]], 23 | [[6.0, 60.0], [667294.821, 6655205.484]], 24 | [[7.0, 60.0], [723020.074, 6658157.202]], 25 | [[8.0, 60.0], [778711.23, 6661953.041]] 26 | ], 27 | "description": "Test 5101 (part 2), Transverse Mercator, v2-0_2011-06-28, recommended JHS formula", 28 | "projections": ["+init=epsg:4326", "+init=epsg:32631"], 29 | "tests": [ 30 | {"tolerances": [2.7777777777777776e-07, 0.03], "type": "conversion"}, 31 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"}] 32 | } 33 | -------------------------------------------------------------------------------- /test/gigs/5101.3-jhs.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[146, 80], [596813.055, 18885748.71]], 4 | [[146, 60], [778711.23, 16661953.04]], 5 | [[146, 40], [926893.302, 14439746.92]], 6 | [[146, 20], [1023538.687, 12219308.24]], 7 | [[146, 0], [1057087.12, 10000000.0]], 8 | [[146, -20], [1023538.687, 7780691.762]], 9 | [[146, -40], [926893.302, 5560253.083]], 10 | [[146, -60], [778711.23, 3338046.96]], 11 | [[146, -80], [596813.055, 1114251.292]], 12 | [[136, -60], [221288.77, 3338046.96]], 13 | [[137, -60], [276979.926, 3341842.798]], 14 | [[138, -60], [332705.179, 3344794.516]], 15 | [[139, -60], [388455.958, 3346902.565]], 16 | [[140, -60], [444223.733, 3348167.265]], 17 | [[141, -60], [500000.0, 3348588.81]], 18 | [[142, -60], [555776.267, 3348167.265]], 19 | [[143, -60], [611544.042, 3346902.565]], 20 | [[144, -60], [667294.821, 3344794.516]], 21 | [[145, -60], [723020.074, 3341842.798]], 22 | [[146, -60], [778711.23, 3338046.96]], 23 | [[147, -60], [834359.668, 3333406.428]], 24 | [[148, -60], [889956.701, 3327920.506]], 25 | [[149, -60], [945493.565, 3321588.377]] 26 | ], 27 | "description": "Test 5101 (part 3), Transverse Mercator, v2-0_2011-06-28, recommended JHS formula", 28 | "projections": ["+init=epsg:4283", "+init=epsg:28354"], 29 | "tests": [ 30 | {"tolerances": [2.7777777777777776e-07, 0.03], "type": "conversion"}, 31 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"} 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /test/gigs/5102.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[5, 58], [760722.92, 3457368.68]], 4 | [[5, 57], [764566.844, 3343948.93]], 5 | [[5, 56], [768396.683, 3230944.812]], 6 | [[5, 55], [772213.973, 3118310.947]], 7 | [[5, 54], [776020.189, 3006003.839]], 8 | [[5, 53], [779816.748, 2893981.68]], 9 | [[4, 51], [717027.292, 2668695.784]], 10 | [[4, 50], [719385.249, 2557252.841]], 11 | [[4, 49], [721740.43, 2445941.161]], 12 | [[4, 46.8], [726915.752, 2201342.519]], 13 | [[3, 53], [644764.905, 2891124.195]], 14 | [[4, 53], [712299.916, 2892123.369]], 15 | [[5, 53], [779816.748, 2893981.68]], 16 | [[6, 53], [847304.473, 2896698.827]], 17 | [[7, 53], [914752.168, 2900274.371]], 18 | [[8, 53], [982148.913, 2904707.734]], 19 | [[9, 53], [1049483.8, 2909998.196]], 20 | [[10, 53], [1116745.929, 2916144.902]], 21 | [[11, 53], [1183924.412, 2923146.858]] 22 | ], 23 | "description": "Test 5102, Lambert Conic Conformal (1SP), v2-0_2011-06-28.", 24 | "projections": ["+init=epsg:4230", "+init=epsg:2192"], 25 | "tests": [ 26 | {"tolerances": [2.7777777777777776e-07, 0.03], "type": "conversion"}, 27 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"} 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /test/gigs/5102.2.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[2.9586342556, 64.4444444444], [760724.023, 3457334.864]], 4 | [[2.9586342556, 63.3333333333], [764567.882, 3343917.044]], 5 | [[2.9586342556, 62.2222222222], [768397.648, 3230915.06]], 6 | [[2.9586342556, 61.1111111111], [772214.859, 3118283.535]], 7 | [[2.9586342556, 60], [776020.989, 3005978.979]], 8 | [[2.9586342556, 58.8888888889], [779817.454, 2893959.584]], 9 | [[1.8475231444, 56.6666666667], [717027.602, 2668679.866]], 10 | [[1.8475231444, 55.5555555556], [719385.487, 2557240.347]], 11 | [[1.8475231444, 54.4444444444], [721740.59, 2445932.319]], 12 | [[1.8475231444, 52], [726915.726, 2201342.51838845]], 13 | [[0.7364120333, 58.8888888889], [644765.081, 2891102.088]], 14 | [[1.8475231444, 58.8888888889], [712300.356, 2892101.266]], 15 | [[2.9586342556, 58.8888888889], [779817.454, 2893959.584]], 16 | [[4.0697453667, 58.8888888889], [847305.444, 2896676.742]], 17 | [[5.1808564778, 58.8888888889], [914753.403, 2900252.301]], 18 | [[6.2919675889, 58.8888888889], [982150.413, 2904685.68]], 19 | [[7.4030787, 58.8888888889], [1049485.565, 2909976.163]], 20 | [[8.5141898111, 58.8888888889], [1116747.958, 2916122.894]], 21 | [[9.6253009222, 58.8888888889], [1183926.705, 2923124.876]] 22 | ], 23 | "description": "Test 5102 (part 2), Lambert Conic Conformal (1SP), v2-0_2011-06-28.", 24 | "projections": ["+init=epsg:4807", "+init=epsg:27572"], 25 | "tests": [ 26 | {"tolerances": [2.7777777777777776e-07, 0.03], "type": "conversion"}, 27 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"} 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /test/gigs/5103.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[5, 58], [187742.7, 969521.653]], 4 | [[5, 57], [188698.877, 857277.135]], 5 | [[5, 56], [189652.853, 745291.184]], 6 | [[5, 55], [190604.967, 633523.672]], 7 | [[5, 54], [191555.55, 521935.9]], 8 | [[5, 53], [192504.921, 410490.433]], 9 | [[5.3876389, 52.1561606], [219843.841, 316827.604]], 10 | [[4, 51], [124202.936, 187756.876]], 11 | [[4, 50], [123652.406, 76521.628]], 12 | [[4, 49], [123101.889, -34711.068]], 13 | [[3.3137281, 47.9752611], [71254.553, -148236.592]], 14 | [[3, 53], [58108.966, 411155.591]], 15 | [[4, 53], [125304.704, 410370.504]], 16 | [[5, 53], [192504.921, 410490.433]], 17 | [[6, 53], [259697.429, 411515.356]], 18 | [[7, 53], [326870.04, 413445.087]], 19 | [[8, 53], [394010.571, 416279.276]], 20 | [[9, 53], [461106.844, 420017.408]], 21 | [[10, 53], [528146.69, 424658.807]], 22 | [[11, 53], [595117.95, 430202.63]] 23 | ], 24 | 25 | "description": "Test 5103 (part 1), Lambert Conic Conformal (2SP), v2-0_2011-06-28.", 26 | "projections": ["+init=epsg:4313", "+init=epsg:31370"], 27 | "tests": [ {"tolerances": [2.7777777777777776e-07, 0.03], "type": "conversion"}, 28 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"}] 29 | } 30 | -------------------------------------------------------------------------------- /test/gigs/5103.2.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[-110, 49], [2003937.27, 6452491.7]], 4 | [[-110, 47], [2016621.93, 5717728.61]], 5 | [[-110, 45], [2029255.57, 4985920.56]], 6 | [[-110, 43], [2041855.08, 4256089.74]], 7 | [[-110, 41], [2054436.57, 3527302.73]], 8 | [[-110, 41], [2054436.57, 3527302.73]], 9 | [[-108, 41], [2606245.52, 3543182.55]], 10 | [[-106, 41], [3157542.86, 3571757.39]], 11 | [[-104, 41], [3708036.57, 3613012.12]], 12 | [[-102, 41], [4257435.06, 3666924.89]] 13 | ], 14 | "description": "Test 5103 (part 2), Lambert Conic Conformal (2SP), v2-0_2011-06-28.", 15 | "projections": ["+init=epsg:4152", "+init=epsg:2921"], 16 | 17 | "tests": [ 18 | {"tolerances": [2.7777777777777776e-07, 0.03], "type": "conversion"}, 19 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"} 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /test/gigs/5103.3.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[-110, 49], [2003933.27, 6452478.8]], 4 | [[-110, 47], [2016617.9, 5717717.18]], 5 | [[-110, 45], [2029251.51, 4985910.59]], 6 | [[-110, 43], [2041851.0, 4256081.23]], 7 | [[-110, 41], [2054432.46, 3527295.67]], 8 | [[-110, 41], [2054432.46, 3527295.67]], 9 | [[-108, 41], [2606240.3, 3543175.46]], 10 | [[-106, 41], [3157536.54, 3571750.25]], 11 | [[-104, 41], [3708029.16, 3613004.9]], 12 | [[-102, 41], [4257426.54, 3666917.56]] 13 | ], 14 | "description": "Test 5103 (part 3), Lambert Conic Conformal (2SP), v2-0_2011-06-28.", 15 | "projections": ["+init=epsg:4152", "+init=epsg:3568"], 16 | "tests": [ 17 | {"tolerances": [2.7777777777777776e-07, 0.03], "type": "conversion"}, 18 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"} 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /test/gigs/5104.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[5, 58], [132023.27, 1114054.87]], 4 | [[5, 57], [131405.466, 1002468.081]], 5 | [[5, 56], [130792.264, 890981.281]], 6 | [[5, 55], [130183.56, 779577.7]], 7 | [[5, 54], [129579.26, 668240.58]], 8 | [[5, 53], [128979.26, 556953.19]], 9 | [[5.38763888888889, 52.1561605555556], [155000, 463000]], 10 | [[4, 51], [57605.946, 335312.662]], 11 | [[4, 50], [55502.306, 224086.514]], 12 | [[4.0, 49.0], [53412.76, 112842.73]], 13 | [[3.31372805555556, 47.9752611111111], [0, 0]], 14 | [[3, 53], [-5253.06, 559535.55]], 15 | [[4, 53], [61856.78, 557779.12]], 16 | [[5, 53], [128979.26, 556953.19]], 17 | [[6, 53], [196105.28, 557057.74]], 18 | [[7, 53], [263225.72, 558092.77]], 19 | [[8, 53], [330331.46, 560058.31]], 20 | [[9, 53], [397413.385, 562954.436]], 21 | [[10, 53], [464462.35, 566781.24]], 22 | [[11, 53], [531469.2, 571538.84]] 23 | ], 24 | "description": "Test 5104, Oblique stereographic, v2-0_2011-06-28.", 25 | "projections": ["+init=epsg:4289", "+init=epsg:28992"], 26 | "tests": [ 27 | {"tolerances": [5.555555555555555e-07, 0.05], "type": "conversion"}, 28 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"} 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /test/gigs/5105.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[117, 12], [807919.14, 1329535.33]], 4 | [[117, 10], [808784.98, 1107678.47]], 5 | [[117, 9], [809334.18, 996918.21]], 6 | [[117, 8], [809939.3, 886240.18]], 7 | [[116.8465522, 6.8784583], [793704.63, 762081.05]], 8 | [[117, 6], [811253.3, 665041.27]], 9 | [[117, 5], [811930.35, 554475.63]], 10 | [[117, 4], [812599.58, 443902.71]], 11 | [[115, 4], [590521.15, 442890.86]], 12 | [[117, 3], [813245.13, 333300.13]], 13 | [[117, 2], [813851.07, 222645.51]], 14 | [[117.0, 1.0], [814401.38, 111916.45]], 15 | [[109.6858208, -0.0001733], [0, 0]], 16 | [[123, 6], [1475669.28, 673118.57]], 17 | [[122, 6], [1364854.86, 671146.25]], 18 | [[121, 6], [1254086.17, 669446.25]], [[120.0, 6.0], [1143352.6, 668002.07]], [[119.0, 6.0], [1032643.31, 666797.35]], [[118.0, 6.0], [921947.29, 665815.82]], [[117.0, 6.0], [811253.3, 665041.27]], [[116.0, 6.0], [700549.97, 664457.59]], [[115.0, 6.0], [589825.71, 664048.72]], 19 | [[114, 6], [479068.802, 663798.63]] 20 | ], 21 | "description": "Test 5105 (part 1), Oblique Mercator (variant B), v2-0_2011-06-28.", 22 | "projections": ["+init=epsg:4742", 23 | "+proj=somerc +lat_0=4 +lonc=115 +alpha=53.31580995 +k=0.99984 +x_0=0 +y_0=0 +no_uoff +gamma=53.13010236111111 +ellps=GRS80 +units=m +no_defs"], 24 | "tests": [{"tolerances": [5.555555555555555e-07, 0.05], "type": "conversion"}, 25 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"}] 26 | } 27 | -------------------------------------------------------------------------------- /test/gigs/5105.2.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[16, 48.5], [424714.235, 355124.6]], 4 | [[17.2, 48.0], [512056.188, 296756.716]], 5 | [[17.582650555556, 47.636134722222], [539847.765, 255701.086]], 6 | [[19.048571666667, 47.144393611111], [650000, 200000]], 7 | [[19.223429444445, 46.875668333333], [663329.053, 170142.318]], 8 | [[20.135740555556, 46.370301111111], [733651.455, 114532.099]], 9 | [[21.4, 45.7], [833148.855, 42191.482]], 10 | [[22.3, 49.3], [886565.935, 444656.613]], 11 | [[21.294198611111, 48.489974722222], [815999.993, 351999.998]], 12 | [[19.223429444445, 46.875668333333], [663329.053, 170142.318]], 13 | [[17.619153611111, 46.068746388889], [539403.958, 81440.103]], 14 | [[16.36, 45.5], [439836.709, 20816.456]] 15 | ], 16 | 17 | "description": "Test 5105 (part 2), Oblique Mercator (variant B), v2-0_2011-06-28.", 18 | "projections": ["+init=epsg:4237", "+init=epsg:23700"], 19 | "tests": [ 20 | {"tolerances": [5.555555555555555e-07, 0.05], "type": "conversion"}, 21 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"} 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /test/gigs/5106.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[117, 12], [807919.144, 1329535.334]], 4 | [[117, 10], [808784.981, 1107678.473]], 5 | [[117, 9], [809334.177, 996918.212]], 6 | [[117, 8], [809939.302, 886240.183]], 7 | [[116.8465522222222222224906494, 6.878458333333333334122825262], [793704.631, 762081.047]], 8 | [[117, 6], [811253.303, 665041.265]], 9 | [[117, 5], [811930.345, 554475.627]], 10 | [[117, 4], [812599.582, 443902.706]], 11 | [[115, 4], [590521.147, 442890.861]], 12 | [[117, 3], [813245.133, 333300.13]], 13 | [[117, 2], [813851.067, 222645.511]], 14 | [[117, 1], [814401.375, 111916.452]], 15 | [[109.6858208333333333333530706, -0.0001733333333333333330866171056], [0, 0]], 16 | [[123, 6], [1475669.281, 673118.573]], 17 | [[122, 6], [1364854.862, 671146.254]], 18 | [[121, 6], [1254086.173, 669446.249]], 19 | [[120, 6], [1143352.598, 668002.074]], 20 | [[119, 6], [1032643.312, 666797.354]], 21 | [[118, 6], [921947.286, 665815.815]], 22 | [[117, 6], [811253.303, 665041.265]], 23 | [[116, 6], [700549.965, 664457.586]], 24 | [[115, 6], [589825.706, 664048.715]], 25 | [[114, 6], [479068.802, 663798.63]] 26 | ], 27 | 28 | "description": "Test 5106, Hotine Oblique Mercator (variant A), v2-0_2011-06-28.", 29 | 30 | "projections": ["+init=epsg:4742", "+init=epsg:3376"], 31 | "tests": [ 32 | {"tolerances": [5.555555555555555e-07, 0.05], "type": "conversion"}, 33 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"} 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /test/gigs/5107.json: -------------------------------------------------------------------------------- 1 | { 2 | "projections": [ 3 | "+init=epsg:4674", 4 | "+proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs " 5 | ], 6 | "tests": [ 7 | {"type": "conversion", "tolerances": [5.555555555555555e-07, 0.05]}, 8 | {"type": "roundtrip", "times": 1000, "tolerances": [5.555555555555556e-08, 0.006]} 9 | ], 10 | "coordinates": [ 11 | [[-54, 0], [5000000.0, 10000000.0]], 12 | [[-45, 6], [5996378.70981775, 10671650.0559245]], 13 | [[-45, 0], [6001875.41713946, 10000000.0]], 14 | [[-45, -6], [5996378.70981775, 9328349.94407546]], 15 | [[-41, -13], [6409689.58687533, 8526306.26193173]], 16 | [[-38, -20], [6671808.91962898, 7707735.72987798]], 17 | [[-37, -24], [6725584.49172815, 7240461.99578364]], 18 | [[-36, -30], [6729619.73995286, 6543762.57643596]], 19 | [[-57, -30], [4710574.22343996, 6676097.81116979]], 20 | [[-54, -29.3674766667], [5000000.0, 6750000.0]], 21 | [[-47, -27.5], [5691318.14688622, 6937461.05067494]], 22 | [[-37, -24], [6725584.49172815, 7240461.99578364]], 23 | [[-30, 22.5], [7458947.7013321, 7313327.31691123]] 24 | ], 25 | "description": "Test 5107, American Polyconic, v2-0_2011-06-28." 26 | } 27 | -------------------------------------------------------------------------------- /test/gigs/5108.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[106, 10], [267186.017, 881108.902]], 4 | [[106, 9], [268006.024, 770398.186]], 5 | [[106, 8], [268740.351, 659692.254]], 6 | [[106, 7], [269388.786, 548990.588]], 7 | [[106, 6], [269951.141, 438292.666]], 8 | [[106, 5], [270427.255, 327597.962]], 9 | [[106, 4], [270816.99, 216905.945]], 10 | [[106, 3], [271120.234, 106216.081]], 11 | [[103.561065778024, 2.04246768119792], [0, 0]], 12 | [[103.640259839629, 1.8277648438075], [8813.252, -23740.095]], 13 | [[106, 1], [271466.923, -115159.332]], 14 | [[109, 5], [603116.703, 329668.599]], 15 | [[108, 5], [492221.308, 328807.336]], 16 | [[107, 5], [381324.74, 328117.472]], 17 | [[106, 5], [270427.255, 327597.962]], 18 | [[105, 5], [159529.111, 327248.012]], 19 | [[104, 5], [48630.563, 327067.097]] 20 | ], 21 | 22 | "description": "Test 5108, Cassini-Soldner, v2-0_2011-06-28.", 23 | "projections": ["+init=epsg:4742", "+init=epsg:3377"], 24 | "tests": [{"tolerances": [5.555555555555555e-07, 0.05], "type": "conversion"}, 25 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"}] 26 | } 27 | -------------------------------------------------------------------------------- /test/gigs/5109.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[132, 0], [0, 0]], 4 | [[132, -27], [0, -2926820.89]], 5 | [[140, 0], [966973.98, -30285.6]], 6 | [[140, -20], [832799.36, -2170181.93]], 7 | [[140, -40], [693250.21, -4395794.49]], 8 | [[140, -60], [567313.29, -6404311.16]], 9 | [[140, -80], [486878.674, -7687130.029]], 10 | [[120, -60], [-850274.75, -6426505.13]], 11 | [[130, -60], [-141915.26, -6387653.78]], 12 | [[140, -60], [567313.29, -6404311.16]], 13 | [[150, -60], [1273067.747, -6476375.276]], 14 | [[160, -60], [1971026.26, -6603404.82]], 15 | [[170, -60], [2656914.716, -6784621.89]] 16 | ], 17 | "description": "Test 5109, Albers Equal Area, v2-0_2011-06-28.", 18 | "projections": ["+init=epsg:4283", "+init=epsg:3577"], 19 | "tests": [ 20 | {"tolerances": [5.555555555555555e-07, 0.05], "type": "conversion"}, 21 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"} 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /test/gigs/5110.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[5, 70], [4127824.65822105, 5214090.649]], 4 | [[5, 60], [4041548.13, 4109791.66]], 5 | [[5, 50], [3962799.45, 2999718.853]], 6 | [[5, 40], [3892127.02, 1892578.962]], 7 | [[5, 30], [3830117.9, 796781.677]], 8 | [[10, 52], [4321000.0, 3210000.0]], [[0.0, 50.0], [3606514.43, 3036305.967]], [[3.0, 50.0], [3819948.288, 3011432.894]], [[5.0, 50.0], [3962799.451, 2999718.853]], [[8.0, 50.0], [4177612.521, 2989464.315]], [[10.0, 50.0], [4321000.0, 2987510.567]]], "description": "Test 5110, Lambert Azimuthal Equal Area, v2-0_2011-06-28.", 9 | "projections": ["+init=epsg:4258", "+init=epsg:3035"], 10 | "tests": [{"tolerances": [5.555555555555555e-07, 0.05], "type": "conversion"}, 11 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"}] 12 | } 13 | -------------------------------------------------------------------------------- /test/gigs/5112.json: -------------------------------------------------------------------------------- 1 | { 2 | "coordinates": [ 3 | [[51.0, 42.0], [0.0, 3819897.85]], 4 | [[51.0, 0.0], [0.0, 0.0]], 5 | [[57.0, 0.0], [497112.88, 0.0]], 6 | [[54.0, 20.5], [248556.44, 1724781.5]], 7 | [[67.0, -41.0], [1325634.35, -3709687.25]] 8 | ], 9 | "description": "Test 5112, Mercator (variant B), v2-0_2011-06-28.", 10 | "projections": ["+init=epsg:4284", "+init=epsg:3388"], 11 | "tests": [ 12 | {"tolerances": [5.555555555555555e-07, 0.05], "type": "conversion"}, 13 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"} 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /test/gigs/5113.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Test 5113, Transverse Mercator (South Oriented), v2-0_2011-06-28.", 3 | "coordinates": [ [[22.5, 0.0], [-166998.44, 0.0]], 4 | [[21.5, -25.0], [-50475.46, 2766147.25]], 5 | [[20.5, -30.0], [48243.45, 3320218.65]], 6 | [[19.5, -35.0], [136937.65, 3875621.18]], 7 | [[19.5, -35.0], [136937.65, 3875621.18]] 8 | ], 9 | "projections": ["+init=epsg:4148", "+init=epsg:2049"], 10 | "tests": [{"tolerances": [2.7777777777777776e-07, 0.03], "type": "conversion"}, 11 | {"times": 1000, "tolerances": [5.555555555555556e-08, 0.006], "type": "roundtrip"}] 12 | } 13 | -------------------------------------------------------------------------------- /test/gigs/5203.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "GIGS Test 5203 (part 1), Position Vector 7-parameter transformation, v2.0_2011-06-28. Geographic 2D domain (EPSG method code 9606).", 3 | "projections" : [ "+init=epsg:4277", "+init=epsg:4326" ], 4 | 5 | "coordinates" : [ 6 | [ [150.00567472, 79.99487333], [150.0, 80.0] ], 7 | [ [120.0, 60.0], [119.99435889, 60.00569306] ], 8 | [ [60.00446778, 29.99566778], [60.0, 30.0] ], 9 | [ [0.0, 0.0], [-0.00089056, 0.00483333] ], 10 | [ [-60.00357056, -30.00504639], [-60.0, -30.0] ], 11 | [ [-120.0, -60.0], [-119.9918525, -59.99907361] ], 12 | [ [-150.01693111, -79.99778139], [-150.0, -80.0] ], 13 | [ [-180.0, 70.0], [-179.99637361, 70.005945] ], 14 | [ [-135.00596333, 49.99458694], [-135.0, 50.0] ], 15 | [ [-90.0, 25.0], [-89.99531139, 25.00445833] ], 16 | [ [0.00089056, -0.00483333], [0.0, 0.0] ], 17 | [ [143.9279419, -37.6532236], [143.92634806, -37.65235306] ], 18 | [ [135.00291194, -49.99973028], [135.0, -50.0] ], 19 | [ [180.0, -70.0], [-179.99660139, -70.002485] ] 20 | ], 21 | 22 | "tests" : [ {"type": "conversion", "tolerances": [2.7777777777777776e-07, 2.7777777777777776e-07]}, 23 | {"type": "roundtrip", "times":1000, "tolerances": [5.555555555555556e-08, 5.555555555555556e-08] } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /test/gigs/5204.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "description" : "GIGS Test 5204, Coordinate Frame 7-parameter transformation, v2.0_2011-06-28. Geographic 2D domain (EPSG method code 9607)", 3 | "projections" : [ "+init=epsg:4313", "+init=epsg:4326" ], 4 | 5 | "coordinates" : [ 6 | [ [149.99825389, 80.00155167], [150, 80] ], 7 | [ [120, 60], [120.00197111, 59.99807333] ], 8 | [ [59.99822194, 30.00134083], [60, 30] ], 9 | [ [0, 0], [0.00098139, -0.00081028] ], 10 | [ [-59.99991333, -29.99943917], [-60, -30] ], 11 | [ [-120, -60], [-120.00150694, -59.999835] ], 12 | [ [-149.99532167, -80.00054917], [-150, -80] ], 13 | [ [-180, 70], [179.99939778, 69.99812806] ], 14 | [ [-134.99891389, 50.00183], [-135, 50] ], 15 | [ [-90, 25], [-90.00060583, 24.99862667] ], 16 | [ [-0.00098139, 0.00081028], [0, 0] ], 17 | [ [143.9279419, -37.6532236], [143.92857222, -37.65257083] ], 18 | [ [134.99913472, -50.00096139], [135, -50] ], 19 | [ [180, -70], [179.99888667, -69.99901667] ] 20 | ], 21 | 22 | "tests" : [ {"type": "conversion", "tolerances": [2.7777777777777776e-07, 2.7777777777777776e-07]}, 23 | {"type": "roundtrip", "times":1000, "tolerances": [5.555555555555556e-08, 5.555555555555556e-08] } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /test/gigs/5205.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "description" : "GIGS Test 5205 (Part 1), Molodensky-Badekas 10-parameter transformation, v2.0_2011-06-28. Geographic 2D domain (EPSG method code 9636)", 3 | "projections" : [ "+init=epsg:4289", "+init=epsg:4326" ], 4 | 5 | "coordinates": [ 6 | [ [150.01814371, 79.99494639], [150, 80] ], 7 | [ [120, 60], [119.99001559, 60.00441792] ], 8 | [ [60.00535007, 29.99746103], [60, 30] ], 9 | [ [0, 0], [-0.00007025, 0.0041133] ], 10 | [ [-60.00473241, -30.0042486], [-60, -30] ], 11 | [ [-120, -60], [-119.9922412, -60.00081456] ], 12 | [ [-150.01209192, -79.99612229], [-150, -80] ], 13 | [ [-180, 70], [179.99786174, 70.00666951] ], 14 | [ [-135.00454845, 49.99357566], [-135, 50] ], 15 | [ [-90, 25], [-89.99487454, 25.00457271] ], 16 | [ [0.00007032, -0.00411349], [0, 0] ], 17 | [ [143.9279419, -37.6532236], [143.92330599, -37.65282034] ], 18 | [ [135.00641074, -49.99958243], [135, -50] ], 19 | [ [180, -70], [179.99847886, -70.00362084] ] 20 | ], 21 | 22 | "tests" : [ {"type": "conversion", "tolerances": [2.7777777777777776e-07, 2.7777777777777776e-07]}, 23 | {"type": "roundtrip", "times":1000, "tolerances": [5.555555555555556e-08, 5.555555555555556e-08] } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /test/gigs/5207.1.json: -------------------------------------------------------------------------------- 1 | { 2 | "description" : "Test 5207, NTv2 transformation, v2.0_2011-06-28. Out of transform grid area error tests have been removed.", 3 | "projections" : [ "+init=epsg:4202", "+init=epsg:4283" ], 4 | 5 | "coordinates": [ 6 | [ [-115, -10.05], [-115.001251111111, -10.048637222222] ], 7 | [ [-114.998744166667, -11.001359444445], [-115, -11] ], 8 | [ [-115, -12], [-115.001261388889, -11.998644166667] ], 9 | [ [-138.04, -9], [-138.041132777778, -8.998543333333] ], 10 | [ [-138.043867222222, -9.001456666667], [-138.045, -9] ], 11 | [ [-138.05, -9], [-138.051132777778, -8.998543333333] ], 12 | [ [-138.048867222222, -9.001456666667], [-138.05, -9] ], 13 | [ [-138.053867222222, -9.001456666667], [-138.055, -9] ], 14 | [ [-138.06, -9], [-138.061132777778, -8.998543333333] ], 15 | [ [-138.038730833333, -27.126476388889], [-138.04, -27.125] ], 16 | [ [-138.045, -27.125], [-138.046268888889, -27.123523611111] ], 17 | [ [-138.05, -27.125], [-138.051268888889, -27.123523611111] ], 18 | [ [-138.048731111111, -27.126476388889], [-138.05, -27.125] ], 19 | [ [-138.055, -27.125], [-138.056268888889, -27.123523333333] ], 20 | [ [-138.058731111111, -27.126476666667], [-138.06, -27.125] ], 21 | [ [-136.847222222222, -28.05], [-136.848525277778, -28.048526944445] ], 22 | [ [-137.847222222222, -28.05], [-137.848505555556, -28.048531111111] ], 23 | [ [-138.847222222222, -28.05], [-138.8484925, -28.048518888889] ], 24 | [ [-139.847222222222, -28.05], [-139.848475277778, -28.048507222222] ] 25 | ], 26 | 27 | "tests" : [ {"type": "conversion", "tolerances": [2.7777777777777776e-07, 2.7777777777777776e-07]}, 28 | {"type": "roundtrip", "times":1000, "tolerances": [5.555555555555556e-08, 5.555555555555556e-08]} 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /test/gigs/5208.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "Test 5208, Longitude Rotation, v2.0_2011-06-28.", 3 | "projections" : [ "+init=epsg:4275", "+init=epsg:4807" ], 4 | 5 | "coordinates": [ 6 | [ [5, 58], [2.66277083, 58] ], 7 | [ [5, 56], [2.66277083, 56] ], 8 | [ [5, 55], [2.66277083, 55] ], 9 | [ [5, 53], [2.66277083, 53] ], 10 | [ [4, 51], [1.66277083, 51] ], 11 | [ [4, 49], [1.66277083, 49] ], 12 | [ [2.33722917, 46.8], [0, 46.8] ], 13 | [ [3, 53], [0.66277083, 53] ], 14 | [ [4, 53], [1.66277083, 53] ], 15 | [ [6, 53], [3.66277083, 53] ], 16 | [ [7, 53], [4.66277083, 53] ], 17 | [ [9, 53], [6.66277083, 53] ], 18 | [ [10, 53], [7.66277083, 53] ], 19 | [ [11, 53], [8.66277083, 53] ] 20 | ], 21 | 22 | "tests" : [ {"type": "conversion", "tolerances": [2.7777777777777776e-07, 2.7777777777777776e-07]}, 23 | {"type": "roundtrip", "times":1000, "tolerances": [5.555555555555556e-08, 5.555555555555556e-08] } 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /test/github_issues_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../'); 3 | 4 | describe('#5 (improper nadgrids error)', function () { 5 | it ('+nadgrids=@null should be ignored', function() { 6 | 7 | 8 | }) 9 | 10 | }); 11 | -------------------------------------------------------------------------------- /test/issue_fallback_wkt.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('..'), 3 | fs = require('fs'), 4 | wkt_parse = api.internal.wkt_parse; 5 | 6 | describe('Fallback WKT files with embedded Proj.4 strings', function () { 7 | it('WKT object is generated', function() { 8 | var P = api.pj_init("+proj=eqearth +datum=WGS84"); 9 | var o = api.internal.wkt_make_projcs(P); 10 | assert.deepEqual(o.PROJCS.EXTENSION, ["PROJ4", "+proj=eqearth +datum=WGS84 +wktext"]); 11 | }) 12 | 13 | it('.prj file is converted to Proj.4', function() { 14 | var str = fs.readFileSync('test/prj/issues/qgis_eqearth.prj', 'utf8'); 15 | var proj4 = api.internal.wkt_to_proj4(str); 16 | assert.equal(proj4, "+proj=eqearth +datum=WGS84"); 17 | }) 18 | 19 | it('Patterson round trip', function() { 20 | var input = "+proj=patterson +datum=WGS84"; 21 | var wkt = api.internal.wkt_from_proj4(input); 22 | var output = api.internal.wkt_to_proj4(wkt); 23 | assert.equal(input, output); 24 | }) 25 | 26 | it('EXTENSION is parsed', function () { 27 | var str = fs.readFileSync('test/prj/issues/qgis_eqearth.prj', 'utf8'); 28 | var expect = { 29 | PROJCS: { 30 | NAME: "unnamed", 31 | GEOGCS: { 32 | NAME: "WGS 84", 33 | DATUM: { 34 | NAME: "WGS_1984", 35 | SPHEROID: ["WGS 84",6378137,298.257223563] 36 | }, 37 | PRIMEM: ["Greenwich",0], 38 | UNIT: ["degree",0.0174532925199433] 39 | }, 40 | PROJECTION: ['custom_proj4'], 41 | UNIT: ['Meter', 1], 42 | EXTENSION: ["PROJ4", "+proj=eqearth +datum=WGS84 +wktext"] 43 | } 44 | }; 45 | var parsed = wkt_parse(str); 46 | assert.deepEqual(parsed, expect) 47 | }) 48 | }) 49 | -------------------------------------------------------------------------------- /test/mproj_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../'), 3 | helpers = require('./helpers'), 4 | proj = require('../bin/mproj'); 5 | 6 | describe('mproj', function () { 7 | 8 | it ('non-numeric input (fwd)', function() { 9 | var expect = '*\t*'; 10 | var output = proj('+proj=merc +datum=WGS84')('5dW S'); 11 | assert.equal(output, expect); 12 | }) 13 | 14 | it ('non-numeric input (inv)', function() { 15 | var expect = '*\t*'; 16 | var output = proj('-I +proj=merc +datum=WGS84')('40000 S'); 17 | assert.equal(output, expect); 18 | }) 19 | 20 | it ('-I', function() { 21 | var expect = '5dW\t5dS'; 22 | var output = proj('-I +proj=merc +datum=WGS84')('-556597.45\t-553583.85'); 23 | assert.equal(output, expect); 24 | }) 25 | 26 | it ('-If (decimal degree output)', function() { 27 | var expect = '-5.000\t-5.000'; 28 | var output = proj('-I -f %.3f +proj=merc +datum=WGS84')('-556597.45\t-553583.85'); 29 | assert.equal(output, expect); 30 | }) 31 | 32 | it ('-f %.6f', function() { 33 | var expect = '-556597.453966\t-553583.846816'; 34 | var output = proj('-f %.6f +proj=merc +datum=WGS84')('5dW 5dS'); 35 | assert.equal(output, expect); 36 | }) 37 | 38 | it ('-Es', function() { 39 | var output = proj('-Es +proj=merc +datum=WGS84')('5dW 5dN'); 40 | var expect = '5dW 5dN\t553583.85\t-556597.45'; 41 | assert.equal(output, expect); 42 | }) 43 | 44 | it ('-Er', function() { 45 | var output = proj('-Er +proj=merc +datum=WGS84')('5dN 5dE'); 46 | var expect = '5dN 5dE\t556597.45\t553583.85'; 47 | assert.equal(output, expect); 48 | }) 49 | }) -------------------------------------------------------------------------------- /test/pj_add_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../'); 3 | 4 | describe('pj_add.js', function () { 5 | it('add a passthrough function', function () { 6 | api.pj_add(init, 'passthrough', '', ''); 7 | var P = api.pj_init('+proj=passthrough'); 8 | function init(P) { 9 | P.fwd = function() { 10 | 11 | } 12 | } 13 | 14 | }) 15 | 16 | }); 17 | -------------------------------------------------------------------------------- /test/pj_datums_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../'); 3 | 4 | describe('pj_datums.js', function () { 5 | describe('find_datum()', function () { 6 | it('wgs84', function () { 7 | var target = { 8 | id: 'WGS84', 9 | defn: 'towgs84=0,0,0', 10 | ellipse_id: 'WGS84', 11 | name: 'WGS_1984' 12 | }; 13 | assert.deepEqual(api.internal.find_datum('WGS84'), target); 14 | }) 15 | }) 16 | 17 | }); 18 | -------------------------------------------------------------------------------- /test/pj_read_opts_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | proj = require('../') 3 | 4 | function expect(initStr, expected) { 5 | it (initStr, function() { 6 | var o = proj.internal.pj_read_init_opts(initStr); 7 | assert.strictEqual(o.opts, expected); 8 | }); 9 | } 10 | 11 | describe('mproj_insert_libcache() pj_read_opts()', function () { 12 | it('add a library as a string and read a definition from it', function () { 13 | var str = '# ED50(ED77)\n<4154> +proj=longlat +ellps=intl +towgs84=-117,-132,-164,0,0,0,0 +no_defs <>'; 14 | proj.internal.mproj_insert_libcache('test', str); 15 | assert(proj.internal.mproj_search_libcache('test') == str); 16 | assert(proj.internal.mproj_search_libcache('missing') === null); 17 | assert.deepEqual(proj.internal.pj_read_init_opts('test:4154'), { 18 | opts: '+proj=longlat +ellps=intl +towgs84=-117,-132,-164,0,0,0,0 +no_defs', 19 | comment: 'ED50(ED77)' 20 | }); 21 | }) 22 | }) 23 | 24 | describe('pj_open_lib.js pj_read_opts()', function () { 25 | expect('esri:2000', '+proj=tmerc +lat_0=0 +lon_0=-62 +k=0.999500 +x_0=400000 +y_0=0 +ellps=clrk80 +units=m +no_defs'); 26 | expect('nad27:101', '+proj=tmerc +datum=NAD27 +lon_0=-85d50 +lat_0=30d30 +k=.99996 +x_0=152400.3048006096 +y_0=0 +no_defs'); 27 | expect('epsg:2222', '+proj=tmerc +lat_0=31 +lon_0=-110.1666666666667 +k=0.9999 +x_0=213360 +y_0=0 +datum=NAD83 +units=ft +no_defs'); 28 | expect('IGNF:AMST63', '+title=Ile d\'Amsterdam 1963 +proj=geocent +towgs84=109.7530,-528.1330,-362.2440 +a=6378388.0000 +rf=297.0000000000000 +units=m +no_defs'); 29 | expect('GL27:erie-etal', '+proj=omerc +ellps=clrk66 +k_0=0.9999 +lonc=78d00\'W +lat_0=44d00\'N +alpha=55d40\' +x_0=-3950000 +y_0=-3430000 +no_defs'); 30 | }); 31 | -------------------------------------------------------------------------------- /test/ported_self_tests/aeqd_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('aeqd.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223379.456047271, 111723.757570854126], 23 | [ 223379.456047271, -111723.757570854126], 24 | [-223379.456047271, 111723.757570854126], 25 | [-223379.456047271, -111723.757570854126] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.00179049310992953335, 0.000895246554746200623], 30 | [ 0.00179049310992953335, -0.000895246554746200623], 31 | [-0.00179049310992953335, 0.000895246554746200623], 32 | [-0.00179049310992953335, -0.000895246554746200623] 33 | ]; 34 | 35 | var e_fwd_expect = [ 36 | [ 222616.522190051648, 110596.996549550197], 37 | [ 222616.522190051648, -110596.996549550211], 38 | [-222616.522190051648, 110596.996549550197], 39 | [-222616.522190051648, -110596.996549550211] 40 | ]; 41 | 42 | var e_inv_expect = [ 43 | [ 0.00179663056838724787, 0.000904369476930248902], 44 | [ 0.00179663056838724787, -0.000904369476930248469], 45 | [-0.00179663056838724787, 0.000904369476930248902], 46 | [-0.00179663056838724787, -0.000904369476930248469] 47 | ]; 48 | 49 | var sargs = "+proj=aeqd +a=6400000 +lat_1=0.5 +lat_2=2"; 50 | var eargs = "+proj=aeqd +ellps=GRS80 +lat_1=0.5 +lat_2=2"; 51 | 52 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 53 | helpers.inv_test(sargs, inv_in, s_inv_expect); 54 | helpers.fwd_test(eargs, fwd_in, e_fwd_expect); 55 | helpers.inv_test(eargs, inv_in, e_inv_expect); 56 | }); 57 | -------------------------------------------------------------------------------- /test/ported_self_tests/airy_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('airy.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | describe('Airy', function () { 15 | var s_fwd_expect = [ 16 | [ 189109.88690862127, 94583.752387504152], 17 | [ 189109.88690862127, -94583.752387504152], 18 | [-189109.88690862127, 94583.752387504152], 19 | [-189109.88690862127, -94583.752387504152] 20 | ]; 21 | 22 | var sargs = "+proj=airy +a=6400000 +lat_1=0 +lat_2=2"; 23 | 24 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 25 | }) 26 | }); 27 | -------------------------------------------------------------------------------- /test/ported_self_tests/august_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('august.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | 15 | describe('August', function () { 16 | 17 | var s_fwd_expect = [ 18 | [223404.97818097242, 111722.34028976287], 19 | [223404.97818097242, -111722.34028976287], 20 | [-223404.97818097242, 111722.34028976287], 21 | [-223404.97818097242, -111722.34028976287] 22 | ]; 23 | 24 | var sargs = "+proj=august +a=6400000 +lat_1=0 +lat_2=2"; 25 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 26 | }) 27 | 28 | }); 29 | -------------------------------------------------------------------------------- /test/ported_self_tests/bacon_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('bacon.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | describe('Apian Globular I', function () { 15 | 16 | var s_fwd_expect = [ 17 | [ 223374.57735525275, 111701.07212763709], 18 | [ 223374.57735525275, -111701.07212763709], 19 | [-223374.57735525275, 111701.07212763709], 20 | [-223374.57735525275, -111701.07212763709] 21 | ]; 22 | 23 | var sargs = "+proj=apian +a=6400000 +lat_1=0 +lat_2=2"; 24 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 25 | }) 26 | 27 | describe('Ortelius Oval', function () { 28 | 29 | var s_fwd_expect = [ 30 | [ 223374.57735525275, 111701.07212763709], 31 | [ 223374.57735525275, -111701.07212763709], 32 | [-223374.57735525275, 111701.07212763709], 33 | [-223374.57735525275, -111701.07212763709] 34 | ]; 35 | 36 | var sargs = "+proj=ortel +a=6400000 +lat_1=0 +lat_2=2"; 37 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 38 | }) 39 | 40 | describe('Bacon Globular', function () { 41 | 42 | var s_fwd_expect = [ 43 | [223334.13255596498, 175450.72592266591], 44 | [223334.13255596498, -175450.72592266591], 45 | [-223334.13255596498, 175450.72592266591], 46 | [-223334.13255596498, -175450.72592266591] 47 | ]; 48 | 49 | var sargs = "+proj=bacon +a=6400000 +lat_1=0 +lat_2=2"; 50 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 51 | }) 52 | 53 | }); 54 | -------------------------------------------------------------------------------- /test/ported_self_tests/boggs_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('boggs.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var s_fwd_expect = [ 15 | [ 211949.70080818201, 117720.99830541089], 16 | [ 211949.70080818201, -117720.99830541089], 17 | [-211949.70080818201, 117720.99830541089], 18 | [-211949.70080818201, -117720.99830541089] 19 | ]; 20 | 21 | var sargs = "+proj=boggs +a=6400000 +lat_1=0 +lat_2=2"; 22 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 23 | 24 | }); 25 | -------------------------------------------------------------------------------- /test/ported_self_tests/bonne_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('bonne.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223368.11557252839, 55884.555246393575], 23 | [ 223368.11557463196, -167517.59936969393], 24 | [-223368.11557252839, 55884.555246393575], 25 | [-223368.11557463196, -167517.59936969393] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.0017905615332457991, 0.50089524631087834], 30 | [ 0.0017905610449335603, 0.49910475320072978], 31 | [-0.0017905615332457991, 0.50089524631087834], 32 | [-0.0017905610449335603, 0.49910475320072978] 33 | ]; 34 | 35 | var e_fwd_expect = [ 36 | [ 222605.29609715697, 55321.139565494814], 37 | [ 222605.29609923941, -165827.64779905154], 38 | [-222605.29609715697, 55321.139565494814], 39 | [-222605.29609923941, -165827.64779905154] 40 | ]; 41 | 42 | var e_inv_expect = [ 43 | [ 0.0017966987691132891, 0.50090436853737497], 44 | [ 0.0017966982774478867, 0.4990956309655612], 45 | [-0.0017966987691132891, 0.50090436853737497], 46 | [-0.0017966982774478867, 0.4990956309655612] 47 | ]; 48 | 49 | var sargs = "+proj=bonne +a=6400000 +lat_1=0.5 +lat_2=2"; 50 | var eargs = "+proj=bonne +ellps=GRS80 +lat_1=0.5 +lat_2=2"; 51 | 52 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 53 | helpers.inv_test(sargs, inv_in, s_inv_expect); 54 | helpers.fwd_test(eargs, fwd_in, e_fwd_expect); 55 | helpers.inv_test(eargs, inv_in, e_inv_expect); 56 | }); 57 | -------------------------------------------------------------------------------- /test/ported_self_tests/cass_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('cass.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223368.10520348375, 111769.14504058579], 23 | [ 223368.10520348375, -111769.14504058579], 24 | [-223368.10520348375, 111769.14504058579], 25 | [-223368.10520348375, -111769.14504058579] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.0017904931100023887, 0.00089524655445477922], 30 | [ 0.0017904931100023887, -0.00089524655445477922], 31 | [-0.0017904931100023887, 0.00089524655445477922], 32 | [-0.0017904931100023887, -0.00089524655445477922] 33 | ]; 34 | 35 | var e_fwd_expect = [ 36 | [ 222605.28577699114, 110642.22925399939], 37 | [ 222605.28577699114, -110642.22925399939], 38 | [-222605.28577699114, 110642.22925399939], 39 | [-222605.28577699114, -110642.22925399939] 40 | ]; 41 | 42 | var e_inv_expect = [ 43 | [ 0.0017966305684613522, 0.00090436947663183841], 44 | [ 0.0017966305684613522, -0.00090436947663183841], 45 | [-0.0017966305684613522, 0.00090436947663183841], 46 | [-0.0017966305684613522, -0.00090436947663183841] 47 | ]; 48 | 49 | var sargs = "+proj=cass +a=6400000 +lat_1=0.5 +lat_2=2"; 50 | var eargs = "+proj=cass +ellps=GRS80 +lat_1=0.5 +lat_2=2"; 51 | 52 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 53 | helpers.inv_test(sargs, inv_in, s_inv_expect); 54 | helpers.fwd_test(eargs, fwd_in, e_fwd_expect); 55 | helpers.inv_test(eargs, inv_in, e_inv_expect); 56 | }); 57 | -------------------------------------------------------------------------------- /test/ported_self_tests/chamb_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('chamb.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | describe('Chamberlin Trimetric', function () { 15 | var s_fwd_expect = [ 16 | [-2268126.571005206089, 2588394.127868260723], 17 | [-2271989.262267768849, 2362083.871856109239], 18 | [-2710092.019056153949, 2605936.202218807302], 19 | [-2714768.974863475189, 2377623.170090894215] 20 | ]; 21 | 22 | var sargs = "+proj=chamb +a=6400000 +lat_1=22N +lon_1=0 +lat_2=22N +lon_2=45E +lat_3=22S +lon_3=22.5E"; 23 | 24 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 25 | }) 26 | }); 27 | -------------------------------------------------------------------------------- /test/ported_self_tests/crast_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('crast.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | describe('Craster Parabolic', function () { 22 | 23 | var s_fwd_expect = [ 24 | [218280.142056780722, 114306.045604279774], 25 | [218280.142056780722, -114306.045604279774], 26 | [-218280.142056780722, 114306.045604279774], 27 | [-218280.142056780722, -114306.045604279774] 28 | ]; 29 | 30 | var s_inv_expect = [ 31 | [0.00183225941982580187, 0.00087483943098902331], 32 | [0.00183225941982580187, -0.00087483943098902331], 33 | [-0.00183225941982580187, 0.00087483943098902331], 34 | [-0.00183225941982580187, -0.00087483943098902331] 35 | ]; 36 | 37 | var sargs = "+proj=crast +a=6400000 +lat_1=0.5 +lat_2=2"; 38 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 39 | helpers.inv_test(sargs, inv_in, s_inv_expect); 40 | }) 41 | 42 | }); 43 | -------------------------------------------------------------------------------- /test/ported_self_tests/denoy_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('denoy.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | 15 | describe('Denoyer Semi-Elliptical', function () { 16 | 17 | var s_fwd_expect = [ 18 | [ 223377.422876954137, 111701.07212763709], 19 | [ 223377.422876954137, -111701.07212763709], 20 | [-223377.422876954137, 111701.07212763709], 21 | [-223377.422876954137, -111701.07212763709] 22 | ]; 23 | 24 | var sargs = "+proj=denoy +a=6400000 +lat_1=0 +lat_2=2"; 25 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 26 | }) 27 | 28 | }); 29 | -------------------------------------------------------------------------------- /test/ported_self_tests/eqc_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('eqc.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223402.144255274179, 111701.07212763709], 23 | [ 223402.144255274179, -111701.07212763709], 24 | [-223402.144255274179, 111701.07212763709], 25 | [-223402.144255274179, -111701.07212763709] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.00179049310978382265, 0.000895246554891911323], 30 | [ 0.00179049310978382265, -0.000895246554891911323], 31 | [-0.00179049310978382265, 0.000895246554891911323], 32 | [-0.00179049310978382265, -0.000895246554891911323] 33 | ]; 34 | 35 | var sargs = "+proj=eqc +a=6400000 +lat_1=0.5 +lat_2=2"; 36 | 37 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 38 | helpers.inv_test(sargs, inv_in, s_inv_expect); 39 | }); 40 | -------------------------------------------------------------------------------- /test/ported_self_tests/gall_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('gall.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 157969.17113451968, 95345.249178385886], 23 | [ 157969.17113451968, -95345.249178385886], 24 | [-157969.17113451968, 95345.249178385886], 25 | [-157969.17113451968, -95345.249178385886] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.0025321396391918614, 0.001048846580346495], 30 | [ 0.0025321396391918614, -0.001048846580346495], 31 | [-0.0025321396391918614, 0.001048846580346495], 32 | [-0.0025321396391918614, -0.001048846580346495] 33 | ]; 34 | 35 | var sargs = "+proj=gall +a=6400000 +lat_1=0.5 +lat_2=2"; 36 | 37 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 38 | helpers.inv_test(sargs, inv_in, s_inv_expect); 39 | }); 40 | -------------------------------------------------------------------------------- /test/ported_self_tests/gins8_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('gins8.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | 15 | describe('Ginsburg VIII', function () { 16 | 17 | var s_fwd_expect = [ 18 | [ 194350.25093959007, 111703.90763533533], 19 | [ 194350.25093959007, -111703.90763533533], 20 | [-194350.25093959007, 111703.90763533533], 21 | [-194350.25093959007, -111703.90763533533] 22 | ]; 23 | 24 | var sargs = "+proj=gins8 +a=6400000 +lat_1=0 +lat_2=2"; 25 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 26 | }) 27 | 28 | }); 29 | -------------------------------------------------------------------------------- /test/ported_self_tests/gnom_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('gnom.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223492.92474718543, 111780.50920659291], 23 | [ 223492.92474718543, -111780.50920659291], 24 | [-223492.92474718543, 111780.50920659291], 25 | [-223492.92474718543, -111780.50920659291] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.0017904931092009798, 0.00089524655438192376], 30 | [ 0.0017904931092009798, -0.00089524655438192376], 31 | [-0.0017904931092009798, 0.00089524655438192376], 32 | [-0.0017904931092009798, -0.00089524655438192376] 33 | ]; 34 | 35 | var sargs = "+proj=gnom +a=6400000 +lat_1=0.5 +lat_2=2"; 36 | 37 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 38 | helpers.inv_test(sargs, inv_in, s_inv_expect); 39 | }); 40 | -------------------------------------------------------------------------------- /test/ported_self_tests/goode_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('goode.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | describe('Goode Homolosine', function () { 22 | 23 | var s_fwd_expect = [ 24 | [ 223368.11902663155, 111701.07212763709], 25 | [ 223368.11902663155, -111701.07212763709], 26 | [-223368.11902663155, 111701.07212763709], 27 | [-223368.11902663155, -111701.07212763709] 28 | ]; 29 | 30 | var s_inv_expect = [ 31 | [ 0.0017904931100023887, 0.00089524655489191132], 32 | [ 0.0017904931100023887, -0.00089524655489191132], 33 | [-0.0017904931100023887, 0.00089524655489191132], 34 | [-0.0017904931100023887, -0.00089524655489191132] 35 | ]; 36 | 37 | var sargs = "+proj=goode +a=6400000 +lat_1=0.5 +lat_2=2"; 38 | 39 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 40 | helpers.inv_test(sargs, inv_in, s_inv_expect); 41 | 42 | }) 43 | 44 | }); 45 | -------------------------------------------------------------------------------- /test/ported_self_tests/hammer_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('hammer.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | describe('Hammer', function () { 22 | 23 | var s_fwd_expect = [ 24 | [ 223373.78870324057, 111703.90739776699], 25 | [ 223373.78870324057, -111703.90739776699], 26 | [-223373.78870324057, 111703.90739776699], 27 | [-223373.78870324057, -111703.90739776699] 28 | ]; 29 | 30 | var s_inv_expect = [ 31 | [ 0.001790493109965961, 0.00089524655487369749], 32 | [ 0.001790493109965961, -0.00089524655487369749], 33 | [-0.001790493109965961, 0.00089524655487369749], 34 | [-0.001790493109965961, -0.00089524655487369749] 35 | ]; 36 | 37 | var sargs = "+proj=hammer +a=6400000 +lat_1=0.5 +lat_2=2"; 38 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 39 | helpers.inv_test(sargs, inv_in, s_inv_expect); 40 | }) 41 | 42 | }); 43 | -------------------------------------------------------------------------------- /test/ported_self_tests/hatano_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('hatano.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | describe('Hatano', function () { 22 | 23 | var s_fwd_expect = [ 24 | [ 189878.87894652804, 131409.8024406255], 25 | [ 189881.08195244463, -131409.14227607418], 26 | [-189878.87894652804, 131409.8024406255], 27 | [-189881.08195244463, -131409.14227607418] 28 | ]; 29 | 30 | var s_inv_expect = [ 31 | [ 0.0021064624821817597, 0.00076095689425791926], 32 | [ 0.0021064624821676096, -0.00076095777439265377], 33 | [-0.0021064624821817597, 0.00076095689425791926], 34 | [-0.0021064624821676096, -0.00076095777439265377] 35 | ]; 36 | 37 | var sargs = "+proj=hatano +a=6400000 +lat_1=0.5 +lat_2=2"; 38 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 39 | helpers.inv_test(sargs, inv_in, s_inv_expect); 40 | }) 41 | 42 | }); 43 | -------------------------------------------------------------------------------- /test/ported_self_tests/krovak_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('krovak.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | describe('Krovak', function () { 22 | 23 | var e_fwd_expect = [ 24 | [-3196535.2325636409, -6617878.8675514441], 25 | [-3260035.4405521089, -6898873.6148780314], 26 | [-3756305.3288691747, -6478142.5615715114], 27 | [-3831703.6585019818, -6759107.1701553948] 28 | ]; 29 | 30 | var e_inv_expect = [ 31 | [24.836218918719162, 59.758403933233858], 32 | [24.836315484509566, 59.756888425730189], 33 | [24.830447747947495, 59.758403933233858], 34 | [24.830351182157091, 59.756888425730189] 35 | ]; 36 | 37 | var eargs = "+proj=krovak +ellps=GRS80 +no_defs"; 38 | 39 | helpers.fwd_test(eargs, fwd_in, e_fwd_expect); 40 | helpers.inv_test(eargs, inv_in, e_inv_expect); 41 | }) 42 | 43 | }); 44 | -------------------------------------------------------------------------------- /test/ported_self_tests/laea_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('laea.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223365.281370124663, 111716.668072915665], 23 | [ 223365.281370124663, -111716.668072915665], 24 | [-223365.281370124663, 111716.668072915665], 25 | [-223365.281370124663, -111716.668072915665] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.00179049311002060264, 0.000895246554791735271], 30 | [ 0.00179049311002060264, -0.000895246554791735271], 31 | [-0.00179049311002060264, 0.000895246554791735271], 32 | [-0.00179049311002060264, -0.000895246554791735271] 33 | ]; 34 | 35 | var e_fwd_expect = [ 36 | [ 222602.471450095181, 110589.82722441027], 37 | [ 222602.471450095181, -110589.827224408786], 38 | [-222602.471450095181, 110589.82722441027], 39 | [-222602.471450095181, -110589.827224408786] 40 | ]; 41 | 42 | var e_inv_expect = [ 43 | [ 0.00179663056847900867, 0.000904369475966495845], 44 | [ 0.00179663056847900867, -0.000904369475966495845], 45 | [-0.00179663056847900867, 0.000904369475966495845], 46 | [-0.00179663056847900867, -0.000904369475966495845] 47 | ]; 48 | 49 | var sargs = "+proj=laea +a=6400000 +lat_1=0.5 +lat_2=2"; 50 | var eargs = "+proj=laea +ellps=GRS80 +lat_1=0.5 +lat_2=2"; 51 | 52 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 53 | helpers.inv_test(sargs, inv_in, s_inv_expect); 54 | helpers.fwd_test(eargs, fwd_in, e_fwd_expect); 55 | helpers.inv_test(eargs, inv_in, e_inv_expect); 56 | }); 57 | -------------------------------------------------------------------------------- /test/ported_self_tests/lcc_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('lcc.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var e_fwd_expect = [ 22 | [ 222588.439735968423, 110660.533870799671], 23 | [ 222756.879700278747, -110532.797660827026], 24 | [-222588.439735968423, 110660.533870799671], 25 | [-222756.879700278747, -110532.797660827026] 26 | ]; 27 | 28 | var e_inv_expect = [ 29 | [ 0.00179635940600536667, 0.000904232207322381741], 30 | [ 0.00179635817735249777, -0.000904233135128348995], 31 | [-0.00179635940600536667, 0.000904232207322381741], 32 | [-0.00179635817735249777, -0.000904233135128348995] 33 | ]; 34 | 35 | var eargs = "+proj=lcc +ellps=GRS80 +lat_1=0.5 +lat_2=2"; 36 | 37 | helpers.fwd_test(eargs, fwd_in, e_fwd_expect); 38 | helpers.inv_test(eargs, inv_in, e_inv_expect); 39 | }); 40 | -------------------------------------------------------------------------------- /test/ported_self_tests/loxim_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('loxim.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223382.295791338867, 55850.5360638185448], 23 | [ 223393.637462243292, -167551.608191455656], 24 | [-223382.295791338867, 55850.5360638185448], 25 | [-223393.637462243292, -167551.608191455656] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.00179056141104335601, 0.500895246554891926], 30 | [ 0.00179056116683692576, 0.499104753445108074], 31 | [-0.00179056141104335601, 0.500895246554891926], 32 | [-0.00179056116683692576, 0.499104753445108074] 33 | ]; 34 | 35 | var sargs = "+proj=loxim +a=6400000 +lat_1=0.5 +lat_2=2"; 36 | 37 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 38 | helpers.inv_test(sargs, inv_in, s_inv_expect); 39 | }); 40 | -------------------------------------------------------------------------------- /test/ported_self_tests/mill_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('mill.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223402.144255274179, 111704.701754393827], 23 | [ 223402.144255274179, -111704.701754396243], 24 | [-223402.144255274179, 111704.701754393827], 25 | [-223402.144255274179, -111704.701754396243] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.00179049310978382265, 0.000895246554873922024], 30 | [ 0.00179049310978382265, -0.000895246554873922024], 31 | [-0.00179049310978382265, 0.000895246554873922024], 32 | [-0.00179049310978382265, -0.000895246554873922024] 33 | ]; 34 | 35 | var sargs = "+proj=mill +a=6400000 +lat_1=0.5 +lat_2=2"; 36 | 37 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 38 | helpers.inv_test(sargs, inv_in, s_inv_expect); 39 | }); 40 | -------------------------------------------------------------------------------- /test/ported_self_tests/nell_h_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('nell_h.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223385.131640952837, 111698.236533561678], 23 | [ 223385.131640952837, -111698.236533561678], 24 | [-223385.131640952837, 111698.236533561678], 25 | [-223385.131640952837, -111698.236533561678] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.00179049310989310567, 0.000895246554910125378], 30 | [ 0.00179049310989310567, -0.000895246554910125378], 31 | [-0.00179049310989310567, 0.000895246554910125378], 32 | [-0.00179049310989310567, -0.000895246554910125378] 33 | ]; 34 | 35 | var sargs = "+proj=nell_h +a=6400000 +lat_1=0.5 +lat_2=2"; 36 | 37 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 38 | helpers.inv_test(sargs, inv_in, s_inv_expect); 39 | }); 40 | -------------------------------------------------------------------------------- /test/ported_self_tests/nell_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('nell.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | describe('Nell', function () { 22 | 23 | var s_fwd_expect = [ 24 | [ 223385.132504695706, 111698.23644718733], 25 | [ 223385.132504695706, -111698.23644718733], 26 | [-223385.132504695706, 111698.23644718733], 27 | [-223385.132504695706, -111698.23644718733] 28 | ]; 29 | 30 | var s_inv_expect = [ 31 | [ 0.00179049310989310567, 0.000895246554910125161], 32 | [ 0.00179049310989310567, -0.000895246554910125161], 33 | [-0.00179049310989310567, 0.000895246554910125161], 34 | [-0.00179049310989310567, -0.000895246554910125161] 35 | ]; 36 | 37 | var sargs = "+proj=nell +a=6400000 +lat_1=0.5 +lat_2=2"; 38 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 39 | helpers.inv_test(sargs, inv_in, s_inv_expect); 40 | }) 41 | 42 | }); 43 | -------------------------------------------------------------------------------- /test/ported_self_tests/nzmg_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('nzmg.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200000, 100000], 16 | [ 200000,-100000], 17 | [-200000, 100000], 18 | [-200000,-100000] 19 | ]; 20 | 21 | describe('New Zealand Map Grid', function () { 22 | 23 | var e_fwd_expect = [ 24 | [3352675144.74742508, -7043205391.10024357], 25 | [3691989502.77930641, -6729069415.33210468], 26 | [4099000768.45323849, -7863208779.66724873], 27 | [4466166927.36997604, -7502531736.62860489] 28 | ]; 29 | 30 | var e_inv_expect = [ 31 | [175.48208682711271, -69.4226921826331846], 32 | [175.756819472543611, -69.5335710883796168], 33 | [134.605119233460016, -61.4599957106629091], 34 | [134.333684315954827, -61.6215536756024349] 35 | ]; 36 | 37 | var eargs = "+proj=nzmg +ellps=GRS80 +lat_1=0.5 +lat_2=2"; 38 | helpers.fwd_test(eargs, fwd_in, e_fwd_expect); 39 | helpers.inv_test(eargs, inv_in, e_inv_expect); 40 | }) 41 | 42 | }); 43 | -------------------------------------------------------------------------------- /test/ported_self_tests/ob_tran_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('ob_tran.js', function () { 6 | 7 | // TODO: reconcile JS and Proj.4 implementations 8 | return; 9 | 10 | var fwd_in = [ 11 | [ 2, 1], 12 | [ 2,-1], 13 | [-2, 1], 14 | [-2,-1] 15 | ]; 16 | 17 | var inv_in = [ 18 | [ 200, 100], 19 | [ 200,-100], 20 | [-200, 100], 21 | [-200,-100] 22 | ]; 23 | 24 | var s_fwd_expect = [ 25 | [-2.6856872138416592, 1.2374302350496296], 26 | [-2.6954069748943286, 1.2026833954513816], 27 | [-2.8993663925401947, 1.2374302350496296], 28 | [-2.8896466314875244, 1.2026833954513816] 29 | ]; 30 | 31 | var s_inv_expect = [ 32 | [ 121.5518748407577, -2.5361001573966084], 33 | [ 63.261184340201858, 17.585319578673531], 34 | [-141.10073322351622, 26.091712304855108], 35 | [-65.862385598848391, 51.830295078417215] 36 | ]; 37 | 38 | var sargs = "+proj=ob_tran +a=6400000 +o_proj=latlon +o_lon_p=20 +o_lat_p=20 +lon_0=180"; 39 | 40 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 41 | helpers.inv_test(sargs, inv_in, s_inv_expect); 42 | }); 43 | -------------------------------------------------------------------------------- /test/ported_self_tests/ocea_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('ocea.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [19994423.837934087962, 223322.760576727800], 23 | [20217962.128015257418, 223322.760576729401], 24 | [19994423.837934091687, -223322.760576726549], 25 | [20217962.128015264869, -223322.760576724948] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 179.999104753445, 0.001790493110], 30 | [-179.999104753445, 0.001790493110], 31 | [ 179.999104753445, -0.001790493110], 32 | [-179.999104753445, -0.001790493110] 33 | ]; 34 | 35 | var sargs = "+proj=ocea +a=6400000 +lat_1=0.5 +lat_2=2"; 36 | 37 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 38 | helpers.inv_test(sargs, inv_in, s_inv_expect); 39 | }); 40 | -------------------------------------------------------------------------------- /test/ported_self_tests/omerc_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('omerc.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | describe('Oblique Mercator', function () { 22 | 23 | var e_fwd_expect = [ 24 | [ 222650.796885261341, 110642.229314983808], 25 | [ 222650.796885261341, -110642.229314983808], 26 | [-222650.796885261545, 110642.229314983808], 27 | [-222650.796885261545, -110642.229314983808] 28 | ]; 29 | 30 | var e_inv_expect = [ 31 | [ 0.00179663056816996357, 0.000904369474808157338], 32 | [ 0.00179663056816996357, -0.000904369474820879583], 33 | [-0.0017966305681604536, 0.000904369474808157338], 34 | [-0.0017966305681604536, -0.000904369474820879583] 35 | ]; 36 | 37 | var eargs = "+proj=omerc +ellps=GRS80 +lat_1=0.5 +lat_2=2"; 38 | 39 | helpers.fwd_test(eargs, fwd_in, e_fwd_expect); 40 | helpers.inv_test(eargs, inv_in, e_inv_expect); 41 | }) 42 | 43 | }); 44 | -------------------------------------------------------------------------------- /test/ported_self_tests/ortho_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('ortho.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223322.76057672748, 111695.401198614476], 23 | [ 223322.76057672748, -111695.401198614476], 24 | [-223322.76057672748, 111695.401198614476], 25 | [-223322.76057672748, -111695.401198614476] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.0017904931102938101, 0.000895246554928338998], 30 | [ 0.0017904931102938101, -0.000895246554928338998], 31 | [-0.0017904931102938101, 0.000895246554928338998], 32 | [-0.0017904931102938101, -0.000895246554928338998] 33 | ]; 34 | 35 | var sargs = "+proj=ortho +a=6400000 +lat_1=0.5 +lat_2=2"; 36 | 37 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 38 | helpers.inv_test(sargs, inv_in, s_inv_expect); 39 | }); 40 | -------------------------------------------------------------------------------- /test/ported_self_tests/poly_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('poly.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223368.105210218986, 111769.110491224754], 23 | [ 223368.105210218986, -111769.110491224754], 24 | [-223368.105210218986, 111769.110491224754], 25 | [-223368.105210218986, -111769.110491224754] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.0017904931100023887, 0.000895246554454779222], 30 | [ 0.0017904931100023887, -0.000895246554454779222], 31 | [-0.0017904931100023887, 0.000895246554454779222], 32 | [-0.0017904931100023887, -0.000895246554454779222] 33 | ]; 34 | 35 | var e_fwd_expect = [ 36 | [ 222605.285770237475, 110642.194561440483], 37 | [ 222605.285770237475, -110642.194561440483], 38 | [-222605.285770237475, 110642.194561440483], 39 | [-222605.285770237475, -110642.194561440483] 40 | ]; 41 | 42 | var e_inv_expect = [ 43 | [ 0.00179663056846135222, 0.000904369476631838518], 44 | [ 0.00179663056846135222, -0.000904369476631838518], 45 | [-0.00179663056846135222, 0.000904369476631838518], 46 | [-0.00179663056846135222, -0.000904369476631838518] 47 | ]; 48 | 49 | var sargs = "+proj=poly +a=6400000 +lat_1=0.5 +lat_2=2"; 50 | var eargs = "+proj=poly +ellps=GRS80 +lat_1=0.5 +lat_2=2"; 51 | 52 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 53 | helpers.inv_test(sargs, inv_in, s_inv_expect); 54 | helpers.fwd_test(eargs, fwd_in, e_fwd_expect); 55 | helpers.inv_test(eargs, inv_in, e_inv_expect); 56 | }); 57 | -------------------------------------------------------------------------------- /test/ported_self_tests/putp2_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('putp2.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | var inv_in = [ 14 | [ 200, 100], 15 | [ 200,-100], 16 | [-200, 100], 17 | [-200,-100] 18 | ]; 19 | describe('Putnins P2', function () { 20 | 21 | var s_fwd_expect = [ 22 | [ 211638.039634339279, 117895.033043379764], 23 | [ 211638.039634339279, -117895.033043379764], 24 | [-211638.039634339279, 117895.033043379764], 25 | [-211638.039634339279, -117895.033043379764] 26 | ]; 27 | var s_inv_expect = [ 28 | [ 0.00188980221640386672, 0.000848201580276863377], 29 | [ 0.00188980221640386672, -0.000848201580276863377], 30 | [-0.00188980221640386672, 0.000848201580276863377], 31 | [-0.00188980221640386672, -0.000848201580276863377] 32 | ]; 33 | var sargs = "+proj=putp2 +a=6400000 +lat_1=0 +lat_2=2"; 34 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 35 | helpers.inv_test(sargs, inv_in, s_inv_expect); 36 | }) 37 | 38 | }); 39 | -------------------------------------------------------------------------------- /test/ported_self_tests/qsc_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('qsc.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | describe('Quadrilateralized Spherical Cube', function () { 22 | 23 | var e_fwd_expect = [ 24 | [ 304638.450843852363, 164123.870923793991], 25 | [ 304638.450843852363, -164123.870923793991], 26 | [-304638.450843852363, 164123.870923793962], 27 | [-304638.450843852421, -164123.870923793904] 28 | ]; 29 | 30 | var e_inv_expect = [ 31 | [ 0.00132134098471627126, 0.000610652900922527926], 32 | [ 0.00132134098471627126, -0.000610652900922527926], 33 | [-0.00132134098471627126, 0.000610652900922527926], 34 | [-0.00132134098471627126, -0.000610652900922527926] 35 | ]; 36 | 37 | var eargs = "+proj=qsc +ellps=GRS80 +lat_1=0.5 +lat_2=2"; 38 | helpers.fwd_test(eargs, fwd_in, e_fwd_expect); 39 | helpers.inv_test(eargs, inv_in, e_inv_expect); 40 | }) 41 | 42 | }); 43 | -------------------------------------------------------------------------------- /test/ported_self_tests/robin_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('robin.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 189588.423282507836, 107318.530350702888], 23 | [ 189588.423282507836, -107318.530350702888], 24 | [-189588.423282507836, 107318.530350702888], 25 | [-189588.423282507836, -107318.530350702888] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.002109689065506131, 0.000931805533547745983], 30 | [ 0.002109689065506131, -0.000931805533547745983], 31 | [-0.002109689065506131, 0.000931805533547745983], 32 | [-0.002109689065506131, -0.000931805533547745983] 33 | ]; 34 | 35 | var sargs = "+proj=robin +a=6400000 +lat_1=0.5 +lat_2=2"; 36 | 37 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 38 | helpers.inv_test(sargs, inv_in, s_inv_expect); 39 | }); 40 | -------------------------------------------------------------------------------- /test/ported_self_tests/sn_sinu_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('wag.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | describe('Wagner II', function () { 22 | 23 | var s_fwd_expect = [ 24 | [ 206589.88809996162, 120778.04035754716], 25 | [ 206589.88809996162, -120778.04035754716], 26 | [-206589.88809996162, 120778.04035754716], 27 | [-206589.88809996162, -120778.04035754716] 28 | ]; 29 | 30 | var s_inv_expect = [ 31 | [ 0.0019360240367390709, 0.00082795765763814082], 32 | [ 0.0019360240367390709, -0.00082795765763814082], 33 | [-0.0019360240367390709, 0.00082795765763814082], 34 | [-0.0019360240367390709, -0.00082795765763814082] 35 | ]; 36 | 37 | var sargs = "+proj=wag2 +a=6400000 +lat_1=0.5 +lat_2=2"; 38 | 39 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 40 | helpers.inv_test(sargs, inv_in, s_inv_expect); 41 | 42 | }) 43 | 44 | }); 45 | -------------------------------------------------------------------------------- /test/ported_self_tests/tmerc_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('tmerc.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | var s_fwd_expect = [ 22 | [ 223413.46640632232, 111769.14504059685], 23 | [ 223413.46640632232, -111769.14504059685], 24 | [-223413.46640632208, 111769.14504059685], 25 | [-223413.46640632208, -111769.14504059685] 26 | ]; 27 | 28 | var s_inv_expect = [ 29 | [ 0.0017904931097048034, 0.00089524670602767842], 30 | [ 0.0017904931097048034, -0.00089524670602767842], 31 | [-0.001790493109714345, 0.00089524670602767842], 32 | [-0.001790493109714345, -0.00089524670602767842] 33 | ]; 34 | 35 | var e_fwd_expect = [ 36 | [ 222650.79679577847, 110642.22941192707], 37 | [ 222650.79679577847, -110642.22941192707], 38 | [-222650.79679577847, 110642.22941192707], 39 | [-222650.79679577847, -110642.22941192707] 40 | ]; 41 | 42 | var e_inv_expect = [ 43 | [ 0.0017966305681649396, 0.00090436947663183841], 44 | [ 0.0017966305681649396, -0.00090436947663183841], 45 | [-0.0017966305681649396, 0.00090436947663183841], 46 | [-0.0017966305681649396, -0.00090436947663183841] 47 | ]; 48 | 49 | var sargs = "+proj=tmerc +a=6400000 +lat_1=0.5 +lat_2=2 +n=0.5"; 50 | var eargs = "+proj=tmerc +ellps=GRS80 +lat_1=0.5 +lat_2=2 +n=0.5"; 51 | 52 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 53 | helpers.inv_test(sargs, inv_in, s_inv_expect); 54 | helpers.fwd_test(eargs, fwd_in, e_fwd_expect); 55 | helpers.inv_test(eargs, inv_in, e_inv_expect); 56 | }); 57 | -------------------------------------------------------------------------------- /test/ported_self_tests/urm5_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('urm5.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var s_fwd_expect = [ 15 | [ 223393.6384339639, 111696.81878511712], 16 | [ 223393.6384339639, -111696.81878511712], 17 | [-223393.6384339639, 111696.81878511712], 18 | [-223393.6384339639, -111696.81878511712] 19 | ]; 20 | 21 | var sargs = "+proj=urm5 +a=6400000 +lat_1=0 +lat_2=2 +n=0.5"; 22 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 23 | 24 | }); 25 | -------------------------------------------------------------------------------- /test/ported_self_tests/wink_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../../'), 3 | helpers = require('../helpers'); 4 | 5 | describe('wink.js', function () { 6 | 7 | var fwd_in = [ 8 | [ 2, 1], 9 | [ 2,-1], 10 | [-2, 1], 11 | [-2,-1] 12 | ]; 13 | 14 | var inv_in = [ 15 | [ 200, 100], 16 | [ 200,-100], 17 | [-200, 100], 18 | [-200,-100] 19 | ]; 20 | 21 | describe('Winkel I', function () { 22 | 23 | var s_fwd_expect = [ 24 | [ 223385.13164095284, 111701.07212763709], 25 | [ 223385.13164095284, -111701.07212763709], 26 | [-223385.13164095284, 111701.07212763709], 27 | [-223385.13164095284, -111701.07212763709] 28 | ]; 29 | 30 | var s_inv_expect = [ 31 | [ 0.0017904931098931057, 0.00089524655489191132], 32 | [ 0.0017904931098931057, -0.00089524655489191132], 33 | [-0.0017904931098931057, 0.00089524655489191132], 34 | [-0.0017904931098931057, -0.00089524655489191132] 35 | ]; 36 | 37 | var sargs = "+proj=wink1 +a=6400000 +lat_1=0.5 +lat_2=2"; 38 | 39 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 40 | helpers.inv_test(sargs, inv_in, s_inv_expect); 41 | }) 42 | 43 | describe('Winkel II', function () { 44 | var s_fwd_expect = [ 45 | [ 223387.39643378611, 124752.03279744535], 46 | [ 223387.39643378611, -124752.03279744535], 47 | [-223387.39643378611, 124752.03279744535], 48 | [-223387.39643378611, -124752.03279744535] 49 | ]; 50 | 51 | var sargs = "+proj=wink2 +a=6400000 +lat_1=0.5 +lat_2=2"; 52 | 53 | helpers.fwd_test(sargs, fwd_in, s_fwd_expect); 54 | }) 55 | 56 | 57 | }); 58 | -------------------------------------------------------------------------------- /test/prj/albers_australia_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["GDA94 / Australian Albers",GEOGCS["GDA94",DATUM["D_GDA_1994",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Albers"],PARAMETER["standard_parallel_1",-18],PARAMETER["standard_parallel_2",-36],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",132],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/albers_australia_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["GDA94 / Australian Albers",GEOGCS["GDA94",DATUM["Geocentric_Datum_of_Australia_1994",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6283"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4283"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Albers_Conic_Equal_Area"],PARAMETER["standard_parallel_1",-18],PARAMETER["standard_parallel_2",-36],PARAMETER["latitude_of_center",0],PARAMETER["longitude_of_center",132],PARAMETER["false_easting",0],PARAMETER["false_northing",0],AUTHORITY["EPSG","3577"],AXIS["Easting",EAST],AXIS["Northing",NORTH]] -------------------------------------------------------------------------------- /test/prj/azimuthal_equidistant_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["North_Pole_Azimuthal_Equidistant",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Azimuthal_Equidistant"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Latitude_Of_Origin",90],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/azimuthal_equidistant_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["North_Pole_Azimuthal_Equidistant",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Azimuthal_Equidistant"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Latitude_Of_Origin",90],UNIT["Meter",1],AUTHORITY["EPSG","102016"]] -------------------------------------------------------------------------------- /test/prj/bc_albers_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD83 / BC Albers",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Albers"],PARAMETER["standard_parallel_1",50],PARAMETER["standard_parallel_2",58.5],PARAMETER["latitude_of_origin",45],PARAMETER["central_meridian",-126],PARAMETER["false_easting",1000000],PARAMETER["false_northing",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/bc_albers_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD83 / BC Albers",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Albers_Conic_Equal_Area"],PARAMETER["standard_parallel_1",50],PARAMETER["standard_parallel_2",58.5],PARAMETER["latitude_of_center",45],PARAMETER["longitude_of_center",-126],PARAMETER["false_easting",1000000],PARAMETER["false_northing",0],AUTHORITY["EPSG","3005"],AXIS["Easting",EAST],AXIS["Northing",NORTH]] -------------------------------------------------------------------------------- /test/prj/british_national_grid_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["OSGB 1936 / British National Grid",GEOGCS["OSGB 1936",DATUM["D_OSGB_1936",SPHEROID["Airy_1830",6377563.396,299.3249646]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",49],PARAMETER["central_meridian",-2],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000],PARAMETER["false_northing",-100000],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/british_national_grid_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["OSGB 1936 / British National Grid",GEOGCS["OSGB 1936",DATUM["OSGB_1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4277"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",49],PARAMETER["central_meridian",-2],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000],PARAMETER["false_northing",-100000],AUTHORITY["EPSG","27700"],AXIS["Easting",EAST],AXIS["Northing",NORTH]] -------------------------------------------------------------------------------- /test/prj/cassini_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Mount Dillon / Tobago Grid",GEOGCS["Mount Dillon",DATUM["D_Mount_Dillon",SPHEROID["Clarke_1858",6378293.645208759,294.2606763692654]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Cassini"],PARAMETER["latitude_of_origin",11.25217861111111],PARAMETER["central_meridian",-60.68600888888889],PARAMETER["false_easting",187500],PARAMETER["false_northing",180000],UNIT["Clarke's link",0.201166195164]] -------------------------------------------------------------------------------- /test/prj/cassini_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Mount Dillon / Tobago Grid",GEOGCS["Mount Dillon",DATUM["Mount_Dillon",SPHEROID["Clarke 1858",6378293.645208759,294.2606763692654,AUTHORITY["EPSG","7007"]],AUTHORITY["EPSG","6157"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4157"]],UNIT["Clarke's link",0.201166195164,AUTHORITY["EPSG","9039"]],PROJECTION["Cassini_Soldner"],PARAMETER["latitude_of_origin",11.25217861111111],PARAMETER["central_meridian",-60.68600888888889],PARAMETER["false_easting",187500],PARAMETER["false_northing",180000],AUTHORITY["EPSG","2066"],AXIS["Easting",EAST],AXIS["Northing",NORTH]] -------------------------------------------------------------------------------- /test/prj/eqdc_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Asia_North_Equidistant_Conic",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Equidistant_Conic"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",95],PARAMETER["Standard_Parallel_1",15],PARAMETER["Standard_Parallel_2",65],PARAMETER["Latitude_Of_Origin",30],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/eqdc_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Asia_North_Equidistant_Conic",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Equidistant_Conic"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",95],PARAMETER["Standard_Parallel_1",15],PARAMETER["Standard_Parallel_2",65],PARAMETER["Latitude_Of_Origin",30],UNIT["Meter",1],AUTHORITY["EPSG","102026"]] -------------------------------------------------------------------------------- /test/prj/eqdc_south_america_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["South_America_Equidistant_Conic",GEOGCS["GCS_South_American_1969",DATUM["D_South_American_1969",SPHEROID["GRS_1967_Truncated",6378160,298.25]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Equidistant_Conic"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-60],PARAMETER["Standard_Parallel_1",-5],PARAMETER["Standard_Parallel_2",-42],PARAMETER["Latitude_Of_Origin",-32],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/equirectangular_sphere_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Sphere_Equidistant_Cylindrical",GEOGCS["GCS_Sphere",DATUM["D_Sphere",SPHEROID["Sphere",6371000,0]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Equidistant_Cylindrical"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Standard_Parallel_1",60],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/equirectangular_sphere_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Sphere_Equidistant_Cylindrical",GEOGCS["GCS_Sphere",DATUM["Not_specified_based_on_Authalic_Sphere",SPHEROID["Sphere",6371000,0]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Equirectangular"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Standard_Parallel_1",60],UNIT["Meter",1],AUTHORITY["EPSG","53002"]] -------------------------------------------------------------------------------- /test/prj/etrs89_austria_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["ETRS89 / Austria Lambert",GEOGCS["ETRS89",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",46],PARAMETER["latitude_of_origin",47.5],PARAMETER["central_meridian",13.33333333333333],PARAMETER["false_easting",400000],PARAMETER["false_northing",400000],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/etrs89_austria_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["ETRS89 / Austria Lambert",GEOGCS["ETRS89",DATUM["European_Terrestrial_Reference_System_1989",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6258"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4258"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",46],PARAMETER["latitude_of_origin",47.5],PARAMETER["central_meridian",13.33333333333333],PARAMETER["false_easting",400000],PARAMETER["false_northing",400000],AUTHORITY["EPSG","3416"],AXIS["Y",EAST],AXIS["X",NORTH]] -------------------------------------------------------------------------------- /test/prj/g33_dotacional_educacion_escuelas.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD83(2011) / Puerto Rico and Virgin Is.", GEOGCS["NAD83(2011)", DATUM["NAD83 (National Spatial Reference System 2011)", SPHEROID["GRS 1980", 6378137.0, 298.257222101, AUTHORITY["EPSG","7019"]], AUTHORITY["EPSG","1116"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic latitude", NORTH], AXIS["Geodetic longitude", EAST], AUTHORITY["EPSG","6318"]], PROJECTION["Lambert_Conformal_Conic_2SP"], PARAMETER["central_meridian", -66.43333333333334], PARAMETER["latitude_of_origin", 17.833333333333332], PARAMETER["standard_parallel_1", 18.433333333333334], PARAMETER["false_easting", 200000.0], PARAMETER["false_northing", 200000.0], PARAMETER["scale_factor", 1.0], PARAMETER["standard_parallel_2", 18.033333333333335], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH], AUTHORITY["EPSG","6566"]] -------------------------------------------------------------------------------- /test/prj/geocentric_esri.prj: -------------------------------------------------------------------------------- 1 | GEOCCS["WGS 84",DATUM["D_World Geodetic System 1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["m",1.0]] -------------------------------------------------------------------------------- /test/prj/geocentric_ogc.prj: -------------------------------------------------------------------------------- 1 | GEOCCS["WGS 84",DATUM["World Geodetic System 1984",SPHEROID["WGS 84",6378137.0,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],UNIT["m",1.0],AXIS["Geocentric X",OTHER],AXIS["Geocentric Y",EAST],AXIS["Geocentric Z",NORTH],AUTHORITY["EPSG","4978"]] -------------------------------------------------------------------------------- /test/prj/issues/Anmarkningar.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223562997]],PRIMEM["Greenwich",0],UNIT["Degree",0.0174532925199433]] 2 | -------------------------------------------------------------------------------- /test/prj/issues/MontVa_Supervisor_Precincts.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD_1983_StatePlane_Virginia_South_FIPS_4502_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",11482916.66666666],PARAMETER["False_Northing",3280833.333333333],PARAMETER["Central_Meridian",-78.5],PARAMETER["Standard_Parallel_1",36.76666666666667],PARAMETER["Standard_Parallel_2",37.96666666666667],PARAMETER["Latitude_Of_Origin",36.33333333333334],UNIT["Foot_US",0.3048006096012192]],VERTCS["NAD_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PARAMETER["Vertical_Shift",0.0],PARAMETER["Direction",1.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/issues/Town_Majia_Sanhe.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_TWD97[2020]",DATUM["D_TWD_1997",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]] -------------------------------------------------------------------------------- /test/prj/issues/papua_new_guinea.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS_1984_UTM_Zone_55S",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",147],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/issues/qgis_eqearth.prj: -------------------------------------------------------------------------------- 1 | PROJCS["unnamed",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["custom_proj4"],UNIT["Meter",1],EXTENSION["PROJ4","+proj=eqearth +datum=WGS84 +wktext"]] 2 | -------------------------------------------------------------------------------- /test/prj/krovak_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["S-JTSK (Ferro) / Krovak",GEOGCS["S-JTSK (Ferro)",DATUM["D_S_JTSK",SPHEROID["Bessel_1841",6377397.155,299.1528128]],PRIMEM["Ferro",-17.66666666666667],UNIT["Degree",0.017453292519943295]],PROJECTION["Krovak"],PARAMETER["latitude_of_center",49.5],PARAMETER["longitude_of_center",42.5],PARAMETER["azimuth",30.28813972222222],PARAMETER["pseudo_standard_parallel_1",78.5],PARAMETER["scale_factor",0.9999],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/krovak_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["S-JTSK (Ferro) / Krovak",GEOGCS["S-JTSK (Ferro)",DATUM["S_JTSK_Ferro",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],AUTHORITY["EPSG","6818"]],PRIMEM["Ferro",-17.66666666666667,AUTHORITY["EPSG","8909"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4818"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Krovak"],PARAMETER["latitude_of_center",49.5],PARAMETER["longitude_of_center",42.5],PARAMETER["azimuth",30.28813972222222],PARAMETER["pseudo_standard_parallel_1",78.5],PARAMETER["scale_factor",0.9999],PARAMETER["false_easting",0],PARAMETER["false_northing",0],AUTHORITY["EPSG","2065"],AXIS["Y",WEST],AXIS["X",SOUTH]] -------------------------------------------------------------------------------- /test/prj/laea_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["US National Atlas Equal Area",GEOGCS["Unspecified datum based upon the Clarke 1866 Authalic Sphere",DATUM["D_Sphere_Clarke_1866_Authalic",SPHEROID["Clarke_1866_Authalic_Sphere",6370997,0]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["latitude_of_origin",45],PARAMETER["central_meridian",-100],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/laea_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["US National Atlas Equal Area",GEOGCS["Unspecified datum based upon the Clarke 1866 Authalic Sphere",DATUM["Not_specified_based_on_Clarke_1866_Authalic_Sphere",SPHEROID["Clarke 1866 Authalic Sphere",6370997,0,AUTHORITY["EPSG","7052"]],AUTHORITY["EPSG","6052"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4052"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["latitude_of_center",45],PARAMETER["longitude_of_center",-100],PARAMETER["false_easting",0],PARAMETER["false_northing",0],AUTHORITY["EPSG","2163"],AXIS["X",EAST],AXIS["Y",NORTH]] -------------------------------------------------------------------------------- /test/prj/lcc_1sp_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["American Samoa 1962 / American Samoa Lambert",GEOGCS["American Samoa 1962",DATUM["D_American_Samoa_1962",SPHEROID["Clarke_1866",6378206.4,294.9786982138982]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["latitude_of_origin",-14.26666666666667],PARAMETER["central_meridian",-170],PARAMETER["scale_factor",1],PARAMETER["false_easting",500000],PARAMETER["false_northing",312234.65],UNIT["Foot_US",0.30480060960121924]] -------------------------------------------------------------------------------- /test/prj/lcc_1sp_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["American Samoa 1962 / American Samoa Lambert",GEOGCS["American Samoa 1962",DATUM["American_Samoa_1962",SPHEROID["Clarke 1866",6378206.4,294.9786982138982,AUTHORITY["EPSG","7008"]],TOWGS84[-115,118,426,0,0,0,0],AUTHORITY["EPSG","6169"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4169"]],UNIT["US survey foot",0.3048006096012192,AUTHORITY["EPSG","9003"]],PROJECTION["Lambert_Conformal_Conic_1SP"],PARAMETER["latitude_of_origin",-14.26666666666667],PARAMETER["central_meridian",-170],PARAMETER["scale_factor",1],PARAMETER["false_easting",500000],PARAMETER["false_northing",312234.65],AUTHORITY["EPSG","3102"],AXIS["X",EAST],AXIS["Y",NORTH]] -------------------------------------------------------------------------------- /test/prj/lcc_oregon_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD83(NSRS2007) / Oregon Lambert (ft)",GEOGCS["NAD83(NSRS2007)",DATUM["D_",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["standard_parallel_1",43],PARAMETER["standard_parallel_2",45.5],PARAMETER["latitude_of_origin",41.75],PARAMETER["central_meridian",-120.5],PARAMETER["false_easting",1312335.958],PARAMETER["false_northing",0],UNIT["Foot",0.3048]] -------------------------------------------------------------------------------- /test/prj/lcc_oregon_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD83(NSRS2007) / Oregon Lambert (ft)",GEOGCS["NAD83(NSRS2007)",DATUM["NAD83_National_Spatial_Reference_System_2007",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6759"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4759"]],UNIT["foot",0.3048,AUTHORITY["EPSG","9002"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",43],PARAMETER["standard_parallel_2",45.5],PARAMETER["latitude_of_origin",41.75],PARAMETER["central_meridian",-120.5],PARAMETER["false_easting",1312335.958],PARAMETER["false_northing",0],AUTHORITY["EPSG","3644"],AXIS["X",EAST],AXIS["Y",NORTH]] -------------------------------------------------------------------------------- /test/prj/mercator_1sp_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Segara / NEIEZ",GEOGCS["Segara",DATUM["D_Gunung_Segara",SPHEROID["Bessel_1841",6377397.155,299.1528128]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["central_meridian",110],PARAMETER["scale_factor",0.997],PARAMETER["false_easting",3900000],PARAMETER["false_northing",900000],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/mercator_1sp_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Segara / NEIEZ",GEOGCS["Segara",DATUM["Gunung_Segara",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],AUTHORITY["EPSG","6613"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4613"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",110],PARAMETER["scale_factor",0.997],PARAMETER["false_easting",3900000],PARAMETER["false_northing",900000],AUTHORITY["EPSG","3000"],AXIS["X",EAST],AXIS["Y",NORTH]] -------------------------------------------------------------------------------- /test/prj/mollweide_world_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Mollweide",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mollweide"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/mollweide_world_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Mollweide",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mollweide"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],UNIT["Meter",1],AUTHORITY["EPSG","54009"]] -------------------------------------------------------------------------------- /test/prj/nsper_world_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Vertical_Perspective",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Vertical_Near_Side_Perspective"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Longitude_Of_Center",0.0],PARAMETER["Latitude_Of_Center",0.0],PARAMETER["Height",35800000.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/nzgd_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NZGD49 / New Zealand Map Grid",GEOGCS["NZGD49",DATUM["D_New_Zealand_1949",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["New_Zealand_Map_Grid"],PARAMETER["latitude_of_origin",-41],PARAMETER["central_meridian",173],PARAMETER["false_easting",2510000],PARAMETER["false_northing",6023150],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/nzgd_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NZGD49 / New Zealand Map Grid",GEOGCS["NZGD49",DATUM["New_Zealand_Geodetic_Datum_1949",SPHEROID["International 1924",6378388,297,AUTHORITY["EPSG","7022"]],TOWGS84[59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993],AUTHORITY["EPSG","6272"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4272"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["New_Zealand_Map_Grid"],PARAMETER["latitude_of_origin",-41],PARAMETER["central_meridian",173],PARAMETER["false_easting",2510000],PARAMETER["false_northing",6023150],AUTHORITY["EPSG","27200"],AXIS["Easting",EAST],AXIS["Northing",NORTH]] -------------------------------------------------------------------------------- /test/prj/omerc_alaska_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD_1983_StatePlane_Alaska_1_FIPS_5001_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],PARAMETER["False_Easting",16404166.66666666],PARAMETER["False_Northing",-16404166.66666666],PARAMETER["Scale_Factor",0.9999],PARAMETER["Azimuth",-36.86989764583333],PARAMETER["Longitude_Of_Center",-133.6666666666667],PARAMETER["Latitude_Of_Center",57],UNIT["Foot_US",0.30480060960121924]] -------------------------------------------------------------------------------- /test/prj/omerc_alaska_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD_1983_StatePlane_Alaska_1_FIPS_5001_Feet",GEOGCS["GCS_North_American_1983",DATUM["North_American_Datum_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Hotine_Oblique_Mercator"],PARAMETER["False_Easting",16404166.66666666],PARAMETER["False_Northing",-16404166.66666666],PARAMETER["Scale_Factor",0.9999],PARAMETER["Azimuth",-36.86989764583333],PARAMETER["Longitude_Of_Center",-133.6666666666667],PARAMETER["Latitude_Of_Center",57],UNIT["Foot_US",0.30480060960121924],AUTHORITY["EPSG","102631"]] -------------------------------------------------------------------------------- /test/prj/omerc_kertau_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Kertau (RSO) / RSO Malaya (ch)",GEOGCS["Kertau (RSO)",DATUM["D_",SPHEROID["Everest_1830_RSO_1969",6377295.664,300.8017]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],PARAMETER["latitude_of_center",4],PARAMETER["longitude_of_center",102.25],PARAMETER["azimuth",323.0257905],PARAMETER["rectified_grid_angle",323.1301023611111],PARAMETER["scale_factor",0.99984],PARAMETER["false_easting",1988.392164223695],PARAMETER["false_northing",0],UNIT["British chain (Sears 1922 truncated)",20.116756]] -------------------------------------------------------------------------------- /test/prj/omerc_kertau_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Kertau (RSO) / RSO Malaya (ch)",GEOGCS["Kertau (RSO)",DATUM["Kertau_RSO",SPHEROID["Everest 1830 (RSO 1969)",6377295.664,300.8017,AUTHORITY["EPSG","7056"]],AUTHORITY["EPSG","6751"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4751"]],UNIT["British chain (Sears 1922 truncated)",20.116756,AUTHORITY["EPSG","9301"]],PROJECTION["Hotine_Oblique_Mercator"],PARAMETER["latitude_of_center",4],PARAMETER["longitude_of_center",102.25],PARAMETER["azimuth",323.0257905],PARAMETER["rectified_grid_angle",323.1301023611111],PARAMETER["scale_factor",0.99984],PARAMETER["false_easting",1988.392164223695],PARAMETER["false_northing",0],AUTHORITY["EPSG","3167"],AXIS["Easting",EAST],AXIS["Northing",NORTH]] -------------------------------------------------------------------------------- /test/prj/omerc_michigan_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD83 / Michigan Oblique Mercator",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],PARAMETER["latitude_of_center",45.30916666666666],PARAMETER["longitude_of_center",-86],PARAMETER["azimuth",337.25556],PARAMETER["rectified_grid_angle",337.25556],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",2546731.496],PARAMETER["false_northing",-4354009.816],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/omerc_michigan_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD83 / Michigan Oblique Mercator",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Hotine_Oblique_Mercator"],PARAMETER["latitude_of_center",45.30916666666666],PARAMETER["longitude_of_center",-86],PARAMETER["azimuth",337.25556],PARAMETER["rectified_grid_angle",337.25556],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",2546731.496],PARAMETER["false_northing",-4354009.816],AUTHORITY["EPSG","3078"],AXIS["X",EAST],AXIS["Y",NORTH]] -------------------------------------------------------------------------------- /test/prj/omerc_michigan_v2_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD_1983_Hotine_Oblique_Mercator_Azimuth_Natural_Origin",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.017453292519943295]],PROJECTION["Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],PARAMETER["longitude_of_center",-86.0],PARAMETER["latitude_of_center",45.30916666666666],PARAMETER["azimuth",337.25555999999995],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",2546731.496],PARAMETER["false_northing",-4354009.816],PARAMETER["rectified_grid_angle",337.25555999999995],UNIT["m",1.0]] -------------------------------------------------------------------------------- /test/prj/omerc_michigan_v2_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD_1983_Hotine_Oblique_Mercator_Azimuth_Natural_Origin",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["degree",0.017453292519943295],AXIS["Longitude",EAST],AXIS["Latitude",NORTH]],PROJECTION["Hotine_Oblique_Mercator"],PARAMETER["longitude_of_center",-86.0],PARAMETER["latitude_of_center",45.30916666666666],PARAMETER["azimuth",337.25555999999995],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",2546731.496],PARAMETER["false_northing",-4354009.816],PARAMETER["rectified_grid_angle",337.25555999999995],UNIT["m",1.0],AXIS["x",EAST],AXIS["y",NORTH],AUTHORITY["UDIG","0"]] -------------------------------------------------------------------------------- /test/prj/omerc_world_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Hotine",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Hotine_Oblique_Mercator_Two_Point_Natural_Origin"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Latitude_Of_1st_Point",20],PARAMETER["Latitude_Of_2nd_Point",60],PARAMETER["Scale_Factor",1],PARAMETER["Longitude_Of_1st_Point",0],PARAMETER["Longitude_Of_2nd_Point",60],PARAMETER["Latitude_Of_Center",40],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/omerc_world_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Hotine",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Hotine_Oblique_Mercator_Two_Point_Natural_Origin"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Latitude_Of_Point_1",20],PARAMETER["Latitude_Of_Point_2",60],PARAMETER["Scale_Factor",1],PARAMETER["Longitude_Of_Point_1",0],PARAMETER["Longitude_Of_Point_2",60],PARAMETER["Latitude_Of_Center",40],UNIT["Meter",1],AUTHORITY["EPSG","54025"]] -------------------------------------------------------------------------------- /test/prj/plate_carree_sphere_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Sphere_Plate_Carree",GEOGCS["GCS_Sphere",DATUM["D_Sphere",SPHEROID["Sphere",6371000.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Plate_Carree"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/plate_carree_sphere_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Sphere_Plate_Carree",GEOGCS["GCS_Sphere",DATUM["Not_specified_based_on_Authalic_Sphere",SPHEROID["Sphere",6371000,0]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Plate_Carree"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],UNIT["Meter",1],AUTHORITY["EPSG","53001"]] -------------------------------------------------------------------------------- /test/prj/prince_edward_island_stereographic_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Prince_Edward_Island_Stereographic",GEOGCS["GCS_ATS_1977",DATUM["D_ATS_1977",SPHEROID["ATS_1977",6378135.0,298.257]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Double_Stereographic"],PARAMETER["False_Easting",700000.0],PARAMETER["False_Northing",400000.0],PARAMETER["Central_Meridian",-63.0],PARAMETER["Scale_Factor",0.999912],PARAMETER["Latitude_Of_Origin",47.25],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/prince_edward_island_stereographic_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["ATS77 / Prince Edward Isl. Stereographic (ATS77)",GEOGCS["ATS77",DATUM["Average_Terrestrial_System_1977",SPHEROID["Average Terrestrial System 1977",6378135,298.257,AUTHORITY["EPSG","7041"]],AUTHORITY["EPSG","6122"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4122"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Oblique_Stereographic"],PARAMETER["latitude_of_origin",47.25],PARAMETER["central_meridian",-63],PARAMETER["scale_factor",0.999912],PARAMETER["false_easting",700000],PARAMETER["false_northing",400000],AUTHORITY["EPSG","2290"],AXIS["E(X)",EAST],AXIS["N(Y)",NORTH]] -------------------------------------------------------------------------------- /test/prj/robinson_sphere_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Sphere_Robinson",GEOGCS["GCS_Sphere",DATUM["D_Sphere",SPHEROID["Sphere",6371000.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Robinson"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/robinson_world_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Robinson",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Robinson"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/stateplane_ny_li_nad83_feet_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",984250.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-74.0],PARAMETER["Standard_Parallel_1",40.66666666666666],PARAMETER["Standard_Parallel_2",41.03333333333333],PARAMETER["Latitude_Of_Origin",40.16666666666666],UNIT["Foot_US",0.3048006096012192]] -------------------------------------------------------------------------------- /test/prj/stateplane_ny_li_nad83_feet_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD83 / New York Long Island (ftUS)",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]],UNIT["US survey foot",0.3048006096012192,AUTHORITY["EPSG","9003"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",41.03333333333333],PARAMETER["standard_parallel_2",40.66666666666666],PARAMETER["latitude_of_origin",40.16666666666666],PARAMETER["central_meridian",-74],PARAMETER["false_easting",984250.0000000002],PARAMETER["false_northing",0],AUTHORITY["EPSG","2263"],AXIS["X",EAST],AXIS["Y",NORTH]] -------------------------------------------------------------------------------- /test/prj/tmerc_epsg2393_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["KKJ_Finland_Uniform_Coordinate_System",GEOGCS["GCS_KKJ",DATUM["D_KKJ",SPHEROID["International_1924",6378388,297]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",27],PARAMETER["scale_factor",1],PARAMETER["false_easting",3500000],PARAMETER["false_northing",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/tmerc_epsg2393_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["KKJ / Finland Uniform Coordinate System",GEOGCS["KKJ",DATUM["Kartastokoordinaattijarjestelma_1966",SPHEROID["International 1924",6378388,297,AUTHORITY["EPSG","7022"]],TOWGS84[-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496],AUTHORITY["EPSG","6123"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4123"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",27],PARAMETER["scale_factor",1],PARAMETER["false_easting",3500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","2393"]] -------------------------------------------------------------------------------- /test/prj/tmerc_wuhan_ejdl.prj: -------------------------------------------------------------------------------- 1 | PROJCS["Beijing_1954_3_Degree_GK_CM_114E",GEOGCS["GCS_Beijing_1954",DATUM["D_Beijing_1954",SPHEROID["Krasovsky_1940",6378245.0,298.3]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Gauss_Kruger"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",114.0],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/ups_south_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS 84 / UPS South",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Stereographic_South_Pole"],PARAMETER["standard_parallel_1",-90],PARAMETER["central_meridian",0],PARAMETER["scale_factor",0.994],PARAMETER["false_easting",2000000],PARAMETER["false_northing",2000000],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/ups_south_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS 84 / UPS South",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Polar_Stereographic"],PARAMETER["latitude_of_origin",-90],PARAMETER["central_meridian",0],PARAMETER["scale_factor",0.994],PARAMETER["false_easting",2000000],PARAMETER["false_northing",2000000],AUTHORITY["EPSG","32761"],AXIS["Easting",UNKNOWN],AXIS["Northing",UNKNOWN]] -------------------------------------------------------------------------------- /test/prj/utm_18N_csrs98_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD83(CSRS98) / UTM zone 18N (deprecated)",GEOGCS["NAD83(CSRS98)",DATUM["D_North_American_1983_CSRS98",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-75],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/utm_18N_csrs98_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["NAD83(CSRS) / UTM zone 18N",GEOGCS["NAD83(CSRS)",DATUM["NAD83_Canadian_Spatial_Reference_System",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6140"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4617"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-75],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],AUTHORITY["EPSG","2959"],AXIS["Easting",EAST],AXIS["Northing",NORTH]] -------------------------------------------------------------------------------- /test/prj/utm_18N_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS_1984_UTM_Zone_18N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-75.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/utm_18N_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS 84 / UTM zone 18N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-75],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],AUTHORITY["EPSG","32618"],AXIS["Easting",EAST],AXIS["Northing",NORTH]] -------------------------------------------------------------------------------- /test/prj/vandg_world_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Van_der_Grinten_I",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Van_der_Grinten_I"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/vandg_world_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Van_der_Grinten_I",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["VanDerGrinten"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],UNIT["Meter",1],AUTHORITY["EPSG","54029"]] -------------------------------------------------------------------------------- /test/prj/web_mercator_aux_sphere_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/web_mercator_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS_1984_Web_Mercator",GEOGCS["GCS_WGS_1984_Major_Auxiliary_Sphere",DATUM["D_WGS_1984_Major_Auxiliary_Sphere",SPHEROID["WGS_1984_Major_Auxiliary_Sphere",6378137.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/web_mercator_v2_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["Popular Visualisation CRS",DATUM["D_Popular_Visualisation_Datum",SPHEROID["Popular_Visualisation_Sphere",6378137,0]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/web_mercator_v2_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["Popular Visualisation CRS",DATUM["Popular_Visualisation_Datum",SPHEROID["Popular Visualisation Sphere",6378137,0,AUTHORITY["EPSG","7059"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6055"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4055"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],AUTHORITY["EPSG","3785"],AXIS["X",EAST],AXIS["Y",NORTH]] -------------------------------------------------------------------------------- /test/prj/web_mercator_v3_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/web_mercator_v3_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]] -------------------------------------------------------------------------------- /test/prj/web_mercator_v4.prj: -------------------------------------------------------------------------------- 1 | PROJCS["WGS_84_Pseudo_Mercator",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator"],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1],PARAMETER["standard_parallel_1",0.0]] -------------------------------------------------------------------------------- /test/prj/wgs84_esri.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] -------------------------------------------------------------------------------- /test/prj/wgs84_ogc.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]] -------------------------------------------------------------------------------- /test/prj/wintri_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Winkel_Tripel_NGS",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.017453292519943295]],PROJECTION["Winkel_Tripel"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",15.0],PARAMETER["Standard_Parallel_1",40.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/wintri_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Winkel_Tripel_NGS",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Winkel_Tripel"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",15.0],PARAMETER["Standard_Parallel_1",40.0],UNIT["Meter",1.0]] -------------------------------------------------------------------------------- /test/prj/world_sinusoidal_esri.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Sinusoidal",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Sinusoidal"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],UNIT["Meter",1]] -------------------------------------------------------------------------------- /test/prj/world_sinusoidal_ogc.prj: -------------------------------------------------------------------------------- 1 | PROJCS["World_Sinusoidal",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Sinusoidal"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],UNIT["Meter",1],AUTHORITY["EPSG","54008"]] -------------------------------------------------------------------------------- /test/proj4_to_wkt_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../'), 3 | wkt_from_proj4 = api.internal.wkt_from_proj4; 4 | 5 | describe('wkt_from_proj() (in wkt.js)', function () { 6 | describe('stere', function () { 7 | // issue #339: error converting +proj=stere 8 | it('+proj=stere', function() { 9 | var wkt = wkt_from_proj4('+proj=stere'); 10 | var expected = 'PROJCS["UNK / Stereographic",GEOGCS["UNK",DATUM["Unknown datum",SPHEROID["WGS 84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["degree",0.017453292519943295]],PROJECTION["Stereographic"],UNIT["Meter",1]]'; 11 | assert.equal(wkt, expected); 12 | }); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /test/projections/geos_test.js: -------------------------------------------------------------------------------- 1 | 2 | var assert = require('assert'), 3 | api = require('../../'), 4 | helpers = require('../helpers'); 5 | 6 | describe('geos.js', function () { 7 | it('test1', function() { 8 | var proj4 = '+proj=geos +h=35785831.0 +lon_0=60 +sweep=y +datum=WGS84'; 9 | helpers.proj_roundtrip(proj4, [83, 3]); 10 | }); 11 | 12 | it('test2', function() { 13 | var proj4 = '+proj=geos +h=35785831.0 +lon_0=60 +sweep=y +R=6378137'; 14 | helpers.proj_roundtrip(proj4, [83, 3]); 15 | }) 16 | 17 | }); -------------------------------------------------------------------------------- /test/projections/webmerc_test.js: -------------------------------------------------------------------------------- 1 | 2 | var assert = require('assert'), 3 | api = require('../../'), 4 | helpers = require('../helpers'); 5 | 6 | describe('+proj=webmerc', function () { 7 | var webmerc = '+proj=webmerc +datum=WGS84'; 8 | var merc = '+proj=merc +a=6378137 +b=6378137'; 9 | 10 | it('test1', function() { 11 | helpers.proj_roundtrip(webmerc, [83, 3]); 12 | }); 13 | 14 | it('test2', function() { 15 | var p = [-83, -3]; 16 | assert.deepEqual(helpers.proj_fwd(webmerc, p), helpers.proj_fwd(merc, p)) 17 | }); 18 | 19 | it('test3', function() { 20 | var p = [-9239517, -334111]; 21 | assert.deepEqual(helpers.proj_inv(webmerc, p), helpers.proj_inv(merc, p)) 22 | }); 23 | }); -------------------------------------------------------------------------------- /test/wkt_geogcs_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | proj = require('../'); 3 | 4 | describe('wkt_geogcs.js', function () { 5 | describe('wkt_get_geogcs_name()', function () { 6 | 7 | function test(proj4, expect) { 8 | it(expect, function() { 9 | var P = proj.pj_init(proj4); 10 | var name = proj.internal.wkt_get_geogcs_name(P); 11 | assert.equal(name, expect); 12 | }); 13 | } 14 | 15 | test('+proj=longlat +datum=NAD83', 'NAD83'); 16 | test('+proj=longlat +datum=WGS84', 'WGS84'); 17 | test('+proj=longlat +datum=potsdam', 'Potsdam'); 18 | test('+init=epsg:4001', 'Unknown datum based upon the Airy 1830 ellipsoid'); 19 | test('+init=epsg:4149', 'CH1903'); 20 | test('+init=esri:4023', 'GCS International 1967'); 21 | 22 | }) 23 | }) 24 | -------------------------------------------------------------------------------- /test/wkt_projcs_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | proj = require('../'); 3 | 4 | describe('wkt_projcs.js', function () { 5 | describe('PROJCS name', function () { 6 | 7 | function test(proj4, expect) { 8 | it(expect, function() { 9 | var P = proj.pj_init(proj4); 10 | var o = proj.internal.wkt_make_projcs(P); 11 | assert.equal(o.PROJCS.NAME, expect); 12 | }); 13 | } 14 | 15 | test('+init=epsg:2287', 'NAD83 / Wisconsin North (ftUS)'); 16 | test('+proj=utm +zone=18 +datum=WGS84 +no_defs', 'WGS84 / UTM zone 18N'); 17 | test('+proj=utm +zone=1 +datum=WGS84 +south +no_defs', 'WGS84 / UTM zone 1S'); // should it be 01S? 18 | test('+proj=robin +datum=WGS84 +no_defs', 'WGS84 / Robinson'); 19 | test('+proj=ups +datum=WGS84 +south +no_defs', 'WGS84 / UPS South'); // should it be 01S 20 | }) 21 | 22 | }) 23 | -------------------------------------------------------------------------------- /test/wkt_stringify_test.js: -------------------------------------------------------------------------------- 1 | var assert = require('assert'), 2 | api = require('../'), 3 | fs = require('fs'); 4 | 5 | describe('wkt_stringify.js', function(){ 6 | var files = [ 7 | 'british_national_grid_esri.prj', 8 | 'british_national_grid_ogc.prj', 9 | 'web_mercator_aux_sphere_esri.prj', 10 | 'web_mercator_v2_esri.prj', 11 | 'web_mercator_v3_esri.prj', 12 | 'web_mercator_v4.prj', 13 | 'ups_south_ogc.prj', 14 | 'omerc_michigan_v2_ogc.prj', 15 | 'utm_18N_esri.prj', 16 | 'utm_18N_ogc.prj', 17 | 'wgs84_esri.prj', 18 | 'wgs84_ogc.prj', 19 | 'wgs84_ogc.prj', 20 | 'british_national_grid_ogc.prj', // has AXIS 21 | 'etrs89_austria_ogc.prj' // has AXIS 22 | ]; 23 | files.forEach(function(file) { 24 | roundtrip('test/prj/' + file); 25 | }); 26 | }); 27 | 28 | function roundtrip(file) { 29 | it(file, function() { 30 | var wkt = fs.readFileSync(file, 'utf8'); 31 | var wkt_obj = api.internal.wkt_parse(wkt); 32 | var wkt2 = api.internal.wkt_stringify(wkt_obj); 33 | var wkt2_obj = api.internal.wkt_parse(wkt2); 34 | // compare parsed objects, because integer values in original wkt strings may 35 | // or may not have ".0" appended 36 | assert.deepEqual(wkt2_obj, wkt_obj); 37 | }) 38 | } 39 | --------------------------------------------------------------------------------