Commit d576c395 authored by Giuseppe La Scaleia's avatar Giuseppe La Scaleia

Add PROJS

parent 8349f8bb
Proj4js.defs["EPSG:102067"] = "+title=Krovak +proj=krovak +lat_0=49.5 +lon_0=42.5 +alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +pm=ferro +units=m +towgs84=570.8,85.7,462.8,4.998,1.587,5.261,3.56 +czech +no_defs";
Proj4js.defs["EPSG:102757"] = "+title=NAD 1983 StatePlane Wyoming West Central FIPS 4903 Feet +proj=tmerc +lat_0=40.5 +lon_0=-108.75 +x_0=600000.0 +y_0=0 +k=0.999938 +a=6378137.0 +b=6356752.3141403 +to_meter=0.3048006096012192";
Proj4js.defs["EPSG:102758"] = "+title=NAD 1983 StatePlane Wyoming West FIPS 4904 Feet +proj=tmerc +lat_0=40.5 +lon_0=-110.0833333333333 +x_0=800000 +y_0=100000 +k=0.999938 +a=6378137.0 +b=6356752.3141403 +to_meter=0.3048006096012192";
Proj4js.defs["EPSG:21781"] = "+title=CH1903 / LV03 +proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +x_0=600000 +y_0=200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs";
Proj4js.defs["EPSG:26591"] = "+title= Monte Mario (Rome) / Italy zone 1 EPSG:26591 +proj=tmerc +lat_0=0 +lon_0=-3.45233333333333 +from_greenwich=12.45233333333333 +k=0.999600 +x_0=1500000 +y_0=0 +a=6378388.0, +b=6356911.94612795 +units=m";
Proj4js.defs["EPSG26912"] = "+title=NAD83 / UTM zone 12N +proj=utm +zone=12 +a=6378137.0 +b=6356752.3141403";
Proj4js.defs["EPSG:27200"] = "+title=New Zealand Map Grid\
+proj=nzmg \
+lat_0=-41 +lon_0=173 \
+x_0=2510000 +y_0=6023150 \
+ellps=intl +datum=nzgd49 +units=m +no_defs"
Proj4js.defs["EPSG:27563"]="+title=NTF (Paris)/Lambert Sud France +proj=lcc +lat_1=44.10000000000001 +lat_0=44.10000000000001 +lon_0=0 +k_0=0.9998774990000001 +x_0=600000 +y_0=200000 +a=6378249.2 +b=6356515 +towgs84=-168,-60,320,0,0,0,0 +pm=paris +units=m +no_defs ";
Proj4js.defs["EPSG:41001"] = "+title=simple mercator EPSG:41001 +proj=merc +lat_ts=0 +lon_0=0 +k=1.000000 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m";
Proj4js.defs["EPSG:4139"] = "+title=Puerto Rico EPSG:4139 (3 param datum shift) +proj=longlat +towgs84 = 11,72,-101,0,0,0,0 +a=6378206.4 +b=6356583.8";
Proj4js.defs["EPSG:4181"] = "+title=Luxembourg 1930 EPSG:4181 (7 param datum shift) +proj=longlat +towgs84=-193,13.7,-39.3,-0.41,-2.933,2.688,0.43 +a=6378388.0, +b=6356911.94612795";
Proj4js.defs["EPSG:42304"]="+title=Atlas of Canada, LCC +proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";
\ No newline at end of file
Proj4js.defs["EPSG:4272"] = "+title=NZGD49 +proj=longlat +ellps=intl +datum=nzgd49 +no_defs ";
Proj4js.defs["EPSG:4302"] = "+title=Trinidad 1903 EPSG:4302 (7 param datum shift) +proj=longlat +a=6378293.63683822 +b=6356617.979337744 +towgs84=-61.702,284.488,472.052,0,0,0,0";
// Google Mercator projection
// Used in combination with GoogleMercator layer type in OpenLayers
//+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs
Proj4js.defs["EPSG:900913"]= "+title=GoogleMercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";
// Google Mercator projection
// Used in combination with GoogleMercator layer type in OpenLayers
//+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs
csList.EPSG900913= "\
+title= Google Mercator EPSG:900913\
+proj=merc +a=6378137 +b=6378137 \
+lat_ts=0.0 +lon_0=0.0 \
+x_0=0.0 +y_0=0 +k=1.0 \
+units=m +nadgrids=@null +no_defs \
";
Proj4js.defs["GOOGLE"]="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";
Proj4js.defs["EPSG:900913"]=Proj4js.defs["GOOGLE"];
/*******************************************************************************
NAME ALBERS CONICAL EQUAL AREA
PURPOSE: Transforms input longitude and latitude to Easting and Northing
for the Albers Conical Equal Area projection. The longitude
and latitude must be in radians. The Easting and Northing
values will be returned in meters.
PROGRAMMER DATE
---------- ----
T. Mittan, Feb, 1992
ALGORITHM REFERENCES
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
*******************************************************************************/
Proj4js.Proj.aea = {
init : function() {
if (Math.abs(this.lat1 + this.lat2) < Proj4js.common.EPSLN) {
Proj4js.reportError("aeaInitEqualLatitudes");
return;
}
this.temp = this.b / this.a;
this.es = 1.0 - Math.pow(this.temp,2);
this.e3 = Math.sqrt(this.es);
this.sin_po=Math.sin(this.lat1);
this.cos_po=Math.cos(this.lat1);
this.t1=this.sin_po;
this.con = this.sin_po;
this.ms1 = Proj4js.common.msfnz(this.e3,this.sin_po,this.cos_po);
this.qs1 = Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);
this.sin_po=Math.sin(this.lat2);
this.cos_po=Math.cos(this.lat2);
this.t2=this.sin_po;
this.ms2 = Proj4js.common.msfnz(this.e3,this.sin_po,this.cos_po);
this.qs2 = Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);
this.sin_po=Math.sin(this.lat0);
this.cos_po=Math.cos(this.lat0);
this.t3=this.sin_po;
this.qs0 = Proj4js.common.qsfnz(this.e3,this.sin_po,this.cos_po);
if (Math.abs(this.lat1 - this.lat2) > Proj4js.common.EPSLN) {
this.ns0 = (this.ms1 * this.ms1 - this.ms2 *this.ms2)/ (this.qs2 - this.qs1);
} else {
this.ns0 = this.con;
}
this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;
this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0)/this.ns0;
},
/* Albers Conical Equal Area forward equations--mapping lat,long to x,y
-------------------------------------------------------------------*/
forward: function(p){
var lon=p.x;
var lat=p.y;
this.sin_phi=Math.sin(lat);
this.cos_phi=Math.cos(lat);
var qs = Proj4js.common.qsfnz(this.e3,this.sin_phi,this.cos_phi);
var rh1 =this.a * Math.sqrt(this.c - this.ns0 * qs)/this.ns0;
var theta = this.ns0 * Proj4js.common.adjust_lon(lon - this.long0);
var x = rh1 * Math.sin(theta) + this.x0;
var y = this.rh - rh1 * Math.cos(theta) + this.y0;
p.x = x;
p.y = y;
return p;
},
inverse: function(p) {
var rh1,qs,con,theta,lon,lat;
p.x -= this.x0;
p.y = this.rh - p.y + this.y0;
if (this.ns0 >= 0) {
rh1 = Math.sqrt(p.x *p.x + p.y * p.y);
con = 1.0;
} else {
rh1 = -Math.sqrt(p.x * p.x + p.y *p.y);
con = -1.0;
}
theta = 0.0;
if (rh1 != 0.0) {
theta = Math.atan2(con * p.x, con * p.y);
}
con = rh1 * this.ns0 / this.a;
qs = (this.c - con * con) / this.ns0;
if (this.e3 >= 1e-10) {
con = 1 - .5 * (1.0 -this.es) * Math.log((1.0 - this.e3) / (1.0 + this.e3))/this.e3;
if (Math.abs(Math.abs(con) - Math.abs(qs)) > .0000000001 ) {
lat = this.phi1z(this.e3,qs);
} else {
if (qs >= 0) {
lat = .5 * Proj4js.common.PI;
} else {
lat = -.5 * Proj4js.common.PI;
}
}
} else {
lat = this.phi1z(this.e3,qs);
}
lon = Proj4js.common.adjust_lon(theta/this.ns0 + this.long0);
p.x = lon;
p.y = lat;
return p;
},
/* Function to compute phi1, the latitude for the inverse of the
Albers Conical Equal-Area projection.
-------------------------------------------*/
phi1z: function (eccent,qs) {
var sinphi, cosphi, con, com, dphi;
var phi = Proj4js.common.asinz(.5 * qs);
if (eccent < Proj4js.common.EPSLN) return phi;
var eccnts = eccent * eccent;
for (var i = 1; i <= 25; i++) {
sinphi = Math.sin(phi);
cosphi = Math.cos(phi);
con = eccent * sinphi;
com = 1.0 - con * con;
dphi = .5 * com * com / cosphi * (qs / (1.0 - eccnts) - sinphi / com + .5 / eccent * Math.log((1.0 - con) / (1.0 + con)));
phi = phi + dphi;
if (Math.abs(dphi) <= 1e-7) return phi;
}
Proj4js.reportError("aea:phi1z:Convergence error");
return null;
}
};
Proj4js.Proj.aeqd = {
init : function() {
this.sin_p12=Math.sin(this.lat0);
this.cos_p12=Math.cos(this.lat0);
},
forward: function(p) {
var lon=p.x;
var lat=p.y;
var ksp;
var sinphi=Math.sin(p.y);
var cosphi=Math.cos(p.y);
var dlon = Proj4js.common.adjust_lon(lon - this.long0);
var coslon = Math.cos(dlon);
var g = this.sin_p12 * sinphi + this.cos_p12 * cosphi * coslon;
if (Math.abs(Math.abs(g) - 1.0) < Proj4js.common.EPSLN) {
ksp = 1.0;
if (g < 0.0) {
Proj4js.reportError("aeqd:Fwd:PointError");
return;
}
} else {
var z = Math.acos(g);
ksp = z/Math.sin(z);
}
p.x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon);
p.y = this.y0 + this.a * ksp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * coslon);
return p;
},
inverse: function(p){
p.x -= this.x0;
p.y -= this.y0;
var rh = Math.sqrt(p.x * p.x + p.y *p.y);
if (rh > (2.0 * Proj4js.common.HALF_PI * this.a)) {
Proj4js.reportError("aeqdInvDataError");
return;
}
var z = rh / this.a;
var sinz=Math.sin(z);
var cosz=Math.cos(z);
var lon = this.long0;
var lat;
if (Math.abs(rh) <= Proj4js.common.EPSLN) {
lat = this.lat0;
} else {
lat = Proj4js.common.asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh);
var con = Math.abs(this.lat0) - Proj4js.common.HALF_PI;
if (Math.abs(con) <= Proj4js.common.EPSLN) {
if (this.lat0 >= 0.0) {
lon = Proj4js.common.adjust_lon(this.long0 + Math.atan2(p.x , -p.y));
} else {
lon = Proj4js.common.adjust_lon(this.long0 - Math.atan2(-p.x , p.y));
}
} else {
con = cosz - this.sin_p12 * Math.sin(lat);
if ((Math.abs(con) < Proj4js.common.EPSLN) && (Math.abs(p.x) < Proj4js.common.EPSLN)) {
//no-op, just keep the lon value as is
} else {
var temp = Math.atan2((p.x * sinz * this.cos_p12), (con * rh));
lon = Proj4js.common.adjust_lon(this.long0 + Math.atan2((p.x * sinz * this.cos_p12), (con * rh)));
}
}
}
p.x = lon;
p.y = lat;
return p;
}
};
/*******************************************************************************
NAME CASSINI
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Cassini projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
Ported from PROJ.4.
ALGORITHM REFERENCES
1. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United
State Government Printing Office, Washington D.C., 1987.
2. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
*******************************************************************************/
//Proj4js.defs["EPSG:28191"] = "+proj=cass +lat_0=31.73409694444445 +lon_0=35.21208055555556 +x_0=170251.555 +y_0=126867.909 +a=6378300.789 +b=6356566.435 +towgs84=-275.722,94.7824,340.894,-8.001,-4.42,-11.821,1 +units=m +no_defs";
// Initialize the Cassini projection
// -----------------------------------------------------------------
Proj4js.Proj.cass = {
init : function() {
if (!this.sphere) {
this.en = Proj4js.common.pj_enfn(this.es)
this.m0 = Proj4js.common.pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);
}
},
C1: .16666666666666666666,
C2: .00833333333333333333,
C3: .04166666666666666666,
C4: .33333333333333333333,
C5: .06666666666666666666,
/* Cassini forward equations--mapping lat,long to x,y
-----------------------------------------------------------------------*/
forward: function(p) {
/* Forward equations
-----------------*/
var x,y;
var lam=p.x;
var phi=p.y;
lam = Proj4js.common.adjust_lon(lam - this.long0);
if (this.sphere) {
x = Math.asin(Math.cos(phi) * Math.sin(lam));
y = Math.atan2(Math.tan(phi) , Math.cos(lam)) - this.phi0;
} else {
//ellipsoid
this.n = Math.sin(phi);
this.c = Math.cos(phi);
y = Proj4js.common.pj_mlfn(phi, this.n, this.c, this.en);
this.n = 1./Math.sqrt(1. - this.es * this.n * this.n);
this.tn = Math.tan(phi);
this.t = this.tn * this.tn;
this.a1 = lam * this.c;
this.c *= this.es * this.c / (1 - this.es);
this.a2 = this.a1 * this.a1;
x = this.n * this.a1 * (1. - this.a2 * this.t * (this.C1 - (8. - this.t + 8. * this.c) * this.a2 * this.C2));
y -= this.m0 - this.n * this.tn * this.a2 * (.5 + (5. - this.t + 6. * this.c) * this.a2 * this.C3);
}
p.x = this.a*x + this.x0;
p.y = this.a*y + this.y0;
return p;
},//cassFwd()
/* Inverse equations
-----------------*/
inverse: function(p) {
p.x -= this.x0;
p.y -= this.y0;
var x = p.x/this.a;
var y = p.y/this.a;
var phi, lam;
if (this.sphere) {
this.dd = y + this.lat0;
phi = Math.asin(Math.sin(this.dd) * Math.cos(x));
lam = Math.atan2(Math.tan(x), Math.cos(this.dd));
} else {
/* ellipsoid */
var ph1 = Proj4js.common.pj_inv_mlfn(this.m0 + y, this.es, this.en);
this.tn = Math.tan(ph1);
this.t = this.tn * this.tn;
this.n = Math.sin(ph1);
this.r = 1. / (1. - this.es * this.n * this.n);
this.n = Math.sqrt(this.r);
this.r *= (1. - this.es) * this.n;
this.dd = x / this.n;
this.d2 = this.dd * this.dd;
phi = ph1 - (this.n * this.tn / this.r) * this.d2 * (.5 - (1. + 3. * this.t) * this.d2 * this.C3);
lam = this.dd * (1. + this.t * this.d2 * (-this.C4 + (1. + 3. * this.t) * this.d2 * this.C5)) / Math.cos(ph1);
}
p.x = Proj4js.common.adjust_lon(this.long0+lam);
p.y = phi;
return p;
}//cassInv()
}
/*******************************************************************************
NAME LAMBERT CYLINDRICAL EQUAL AREA
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Lambert Cylindrical Equal Area projection.
This class of projection includes the Behrmann and
Gall-Peters Projections. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
PROGRAMMER DATE
---------- ----
R. Marsden August 2009
Winwaed Software Tech LLC, http://www.winwaed.com
This function was adapted from the Miller Cylindrical Projection in the Proj4JS
library.
Note: This implementation assumes a Spherical Earth. The (commented) code
has been included for the ellipsoidal forward transform, but derivation of
the ellispoidal inverse transform is beyond me. Note that most of the
Proj4JS implementations do NOT currently support ellipsoidal figures.
Therefore this is not seen as a problem - especially this lack of support
is explicitly stated here.
ALGORITHM REFERENCES
1. "Cartographic Projection Procedures for the UNIX Environment -
A User's Manual" by Gerald I. Evenden, USGS Open File Report 90-284
and Release 4 Interim Reports (2003)
2. Snyder, John P., "Flattening the Earth - Two Thousand Years of Map
Projections", Univ. Chicago Press, 1993
*******************************************************************************/
Proj4js.Proj.cea = {
/* Initialize the Cylindrical Equal Area projection
-------------------------------------------*/
init: function() {
//no-op
},
/* Cylindrical Equal Area forward equations--mapping lat,long to x,y
------------------------------------------------------------*/
forward: function(p) {
var lon=p.x;
var lat=p.y;
/* Forward equations
-----------------*/
var dlon = Proj4js.common.adjust_lon(lon -this.long0);
var x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
var y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);
/* Elliptical Forward Transform
Not implemented due to a lack of a matchign inverse function
{
var Sin_Lat = Math.sin(lat);
var Rn = this.a * (Math.sqrt(1.0e0 - this.es * Sin_Lat * Sin_Lat ));
x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
y = this.y0 + Rn * Math.sin(lat) / Math.cos(this.lat_ts);
}
*/
p.x=x;
p.y=y;
return p;
},//ceaFwd()
/* Cylindrical Equal Area inverse equations--mapping x,y to lat/long
------------------------------------------------------------*/
inverse: function(p) {
p.x -= this.x0;
p.y -= this.y0;
var lon = Proj4js.common.adjust_lon( this.long0 + (p.x / this.a) / Math.cos(this.lat_ts) );
var lat = Math.asin( (p.y/this.a) * Math.cos(this.lat_ts) );
p.x=lon;
p.y=lat;
return p;
}//ceaInv()
};
/* similar to equi.js FIXME proj4 uses eqc */
Proj4js.Proj.eqc = {
init : function() {
if(!this.x0) this.x0=0;
if(!this.y0) this.y0=0;
if(!this.lat0) this.lat0=0;
if(!this.long0) this.long0=0;
if(!this.lat_ts) this.lat_ts=0;
if (!this.title) this.title = "Equidistant Cylindrical (Plate Carre)";
this.rc= Math.cos(this.lat_ts);
},
// forward equations--mapping lat,long to x,y
// -----------------------------------------------------------------
forward : function(p) {
var lon= p.x;
var lat= p.y;
var dlon = Proj4js.common.adjust_lon(lon - this.long0);
var dlat = Proj4js.common.adjust_lat(lat - this.lat0 );
p.x= this.x0 + (this.a*dlon*this.rc);
p.y= this.y0 + (this.a*dlat );
return p;
},
// inverse equations--mapping x,y to lat/long
// -----------------------------------------------------------------
inverse : function(p) {
var x= p.x;
var y= p.y;
p.x= Proj4js.common.adjust_lon(this.long0 + ((x - this.x0)/(this.a*this.rc)));
p.y= Proj4js.common.adjust_lat(this.lat0 + ((y - this.y0)/(this.a )));
return p;
}
};
/*******************************************************************************
NAME EQUIDISTANT CONIC
PURPOSE: Transforms input longitude and latitude to Easting and Northing
for the Equidistant Conic projection. The longitude and
latitude must be in radians. The Easting and Northing values
will be returned in meters.