function UTMRefToLatLng() {
var wgs84 = new RefEll(6378137, 6356752.314);
var UTM_F0 = 0.9996;
var a = wgs84.maj;
var eSquared = wgs84.ecc;
var ePrimeSquared = eSquared / (1.0 - eSquared);
var e1 = (1 - Math.sqrt(1 - eSquared)) / (1 + Math.sqrt(1 - eSquared));
var x = this.easting - 500000.0;;
var y = this.northing;
var zoneNumber = this.lngZone;
var zoneLetter = this.latZone;
var longitudeOrigin = (zoneNumber - 1.0) * 6.0 - 180.0 + 3.0;
// Correct y for southern hemisphere
if ((ord(zoneLetter) - ord("N")) < 0) {
y -= 10000000.0;
}
var m = y / UTM_F0;
var mu =
m
/ (a
* (1.0
- eSquared / 4.0
- 3.0 * eSquared * eSquared / 64.0
- 5.0
* Math.pow(eSquared, 3.0)
/ 256.0));
var phi1Rad =
mu
+ (3.0 * e1 / 2.0 - 27.0 * Math.pow(e1, 3.0) / 32.0) * Math.sin(2.0 * mu)
+ (21.0 * e1 * e1 / 16.0 - 55.0 * Math.pow(e1, 4.0) / 32.0)
* Math.sin(4.0 * mu)
+ (151.0 * Math.pow(e1, 3.0) / 96.0) * Math.sin(6.0 * mu);
var n =
a
/ Math.sqrt(1.0 - eSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));
var t = Math.tan(phi1Rad) * Math.tan(phi1Rad);
var c = ePrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);
var r =
a
* (1.0 - eSquared)
/ Math.pow(
1.0 - eSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad),
1.5);
var d = x / (n * UTM_F0);
var latitude = (
phi1Rad
- (n * Math.tan(phi1Rad) / r)
* (d * d / 2.0
- (5.0
+ (3.0 * t)
+ (10.0 * c)
- (4.0 * c * c)
- (9.0 * ePrimeSquared))
* Math.pow(d, 4.0)
/ 24.0
+ (61.0
+ (90.0 * t)
+ (298.0 * c)
+ (45.0 * t * t)
- (252.0 * ePrimeSquared)
- (3.0 * c * c))
* Math.pow(d, 6.0)
/ 720.0)) * (180.0 / Math.PI);
var longitude = longitudeOrigin + (
(d
- (1.0 + 2.0 * t + c) * Math.pow(d, 3.0) / 6.0
+ (5.0
- (2.0 * c)
+ (28.0 * t)
- (3.0 * c * c)
+ (8.0 * ePrimeSquared)
+ (24.0 * t * t))
* Math.pow(d, 5.0)
/ 120.0)
/ Math.cos(phi1Rad)) * (180.0 / Math.PI);
return new LatLng(latitude, longitude);
var sinh = (Math.exp(coordsY) - Math.exp(-coordsY)) / 2;
var degrees = centerLatLng.substring(0,centerLatLng.indexOf("Ã‚Â°"))/1;
var minutes = centerLatLng.substring(centerLatLng.indexOf("Ã‚Â°")+1,centerLatLng.indexOf("."))/ 60;
var seconds = centerLatLng.substring(centerLatLng.indexOf("."),centerLatLng.indexOf("'")) / 3600;
var centerLng = degrees + minutes + seconds;
var lat = Math.atan(sinh);
var lng = coordsX + centerLng;
var rad = 6372795.477598;
var sinh = (Math.exp(coordsY/rad) - Math.exp(-coordsY/rad)) / 2;
alert(sinh);
var lat = Math.atan(sinh);
var degrees = centerLatLng.substring(0,centerLatLng.indexOf("Ã‚Â°"))/1;
var minutes = centerLatLng.substring(centerLatLng.indexOf("Ã‚Â°")+1,centerLatLng.indexOf("."))/ 60;
var seconds = centerLatLng.substring(centerLatLng.indexOf("."),centerLatLng.indexOf("'")) / 3600;
var centerLng = degrees + minutes + seconds;
var lng = (coordsX/rad) + (centerLng);
var rad = 6372795.477598;
var sinh = (Math.exp(coordsY/rad) - Math.exp(-coordsY/rad)) / 2;
var lat = Math.atan(sinh)*(180/Math.PI);
var lngrad = (coordsX/rad) + ((centerLng)*(Math.PI/180))
var lng = (lngrad)*(180/Math.PI);
var rad = 6372795.477598;
var centerLng = (-9367812.99732577/rad);
var X = ((coordsX*0.2985821196282)-9367812.99732577);
var Y = coordsY*0.2985821374044+(4954053.105471344);
var sinh = (Math.exp(Y/rad) - Math.exp(-Y/rad)) / 2;
var lat = Math.atan(sinh)*(180/Math.PI);
var lngrad = (X/rad) + centerLng;
var lng = (lngrad)*(180/Math.PI);
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
Add Context Menu Item | 4 | 44 | |
How can I started with all items collapsed when using Nested Sortable ? | 4 | 21 | |
jquery conditionally populate list boxes | 2 | 24 | |
Is there a script for upgrading or updating sites to use the latest version of code? | 10 | 25 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
16 Experts available now in Live!