Transverse Mercator Inverse  -  x/y to long/lat
322750
public function inverse($p)
    {
        #$phi;  /* temporary angles       */
        #$delta_phi; /* difference between longitudes    */
        $max_iter = 6;      /* maximun number of iterations */

        if (isset($this->sphere) && $this->sphere === true) {
            // spherical form

            $f = exp( $p->x / ($this->a * $this->k0) );
            $g = .5 * ($f - 1 / $f);
            $temp = $this->lat0 + $p->y / ($this->a * $this->k0);
            $h = cos($temp);
            $con = sqrt((1.0 - $h * $h) / (1.0 + $g * $g));
            $lat = Common::asinz( $con );

            if ($temp < 0) {
                $lat = -$lat;
            }

            if (($g == 0) && ($h == 0)) {
                $lon = $this->long0;
            } else {
                $lon = Common::adjust_lon(atan2($g, $h) + $this->long0);
            }
        } else {
            // ellipsoidal form

            $x = $p->x - $this->x0;
            $y = $p->y - $this->y0;

            $con = ($this->ml0 + $y / $this->k0) / $this->a;
            $phi = $con;

            for ($i = 0; true; $i++) {
                $delta_phi = (($con + $this->e1 * sin( 2.0 * $phi ) - $this->e2 * sin( 4.0 * $phi ) + $this->e3 * sin( 6.0 * $phi )) / $this->e0) - $phi;

                $phi += $delta_phi;

                if (abs($delta_phi) <= Common::EPSLN) {
                    break;
                }

                if ($i >= $max_iter) {
                    Proj4php::reportError('tmerc:inverse: Latitude failed to converge');
                    return(95);
                }
            } // for()

            if (abs($phi) < Common::HALF_PI) {
                // sincos(phi, &sin_phi, &cos_phi);
                $sin_phi = sin( $phi );
                $cos_phi = cos( $phi );
                $tan_phi = tan( $phi );

                $c = $this->ep2 * pow( $cos_phi, 2 );
                $cs = pow( $c, 2 );
                $t = pow( $tan_phi, 2 );
                $ts = pow( $t, 2 );
                $con = 1.0 - $this->es * pow( $sin_phi, 2 );
                $n = $this->a / sqrt( $con );
                $r = $n * (1.0 - $this->es) / $con;
                $d = $x / ($n * $this->k0);
                $ds = pow( $d, 2 );
                $lat = $phi - ($n * $tan_phi * $ds / $r) * (0.5 - $ds / 24.0 * (5.0 + 3.0 * $t + 10.0 * $c - 4.0 * $cs - 9.0 * $this->ep2 - $ds / 30.0 * (61.0 + 90.0 * $t + 298.0 * $c + 45.0 * $ts - 252.0 * $this->ep2 - 3.0 * $cs)));
                $lon = Common::adjust_lon( $this->long0 + ($d * (1.0 - $ds / 6.0 * (1.0 + 2.0 * $t + $c - $ds / 20.0 * (5.0 - 2.0 * $c + 28.0 * $t - 3.0 * $cs + 8.0 * $this->ep2 + 24.0 * $ts))) / $cos_phi) );
            } else {
                $lat = Common::HALF_PI * Common::sign( $y );
                $lon = $this->long0;
            }
        }

        $p->x = $lon;
        $p->y = $lat;

        return $p;
    }
775462
function CHtoWGSlat(y, x) {

  // Converts militar to civil and  to unit = 1000km
  // Axiliary values (% Bern)
  const y_aux = (y - 600000) / 1000000;
  const x_aux = (x - 200000) / 1000000;

  // Process lat
  let lat = 16.9023892 +
      3.238272 * x_aux -
      0.270978 * Math.pow(y_aux, 2) -
      0.002528 * Math.pow(x_aux, 2) -
      0.0447 * Math.pow(y_aux, 2) * x_aux -
      0.0140 * Math.pow(x_aux, 3);

  // Unit 10000" to 1 " and converts seconds to degrees (dec)
  lat = lat * 100 / 36;

  return lat;

}
108666
def bearing_to(self, point):
        '''
        
        '''
        delta_long = point.long_radians - self.long_radians
        y = sin(delta_long) * cos(point.lat_radians)
        x = (
            cos(self.lat_radians) * sin(point.lat_radians) -
            sin(self.lat_radians) * cos(point.lat_radians) * cos(delta_long)
        )
        radians = math.atan2(y, x)
        return Bearing.from_radians(radians)
584561
public function inverse($p)
    {
        $x = $p->x;
        $y = $p->y;

        $p->x = Common::adjust_lon( $this->long0 + (($x - $this->x0) / ($this->a * $this->rc)) );
        $p->y = Common::adjust_lat( $this->lat0 + (($y - $this->y0) / ($this->a )) );

        return $p;
    }
853385
public function inverse($p)
    {
        $p->x -= $this->x0;
        $p->y -= $this->y0;
        $x = $p->x / $this->a;
        $y = $p->y / $this->a;

        if ($this->sphere) {
            $this->dd = $y + $this->lat0;
            $phi = asin(sin($this->dd) * cos($x));
            $lam = atan2(tan($x), cos($this->dd));
        } else {
            // ellipsoid
            $ph1 = Common::pj_inv_mlfn($this->m0 + $y, $this->es, $this->en);
            $this->tn = tan($ph1);
            $this->t = $this->tn * $this->tn;
            $this->n = sin($ph1);
            $this->r = 1.0 / (1.0 - $this->es * $this->n * $this->n);
            $this->n = sqrt($this->r);
            $this->r *= (1.0 - $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 * (0.5 - (1.0 + 3.0 * $this->t) * $this->d2 * $this->C3);
            $lam = $this->dd * (1.0 + $this->t * $this->d2 * (-$this->C4 + (1.0 + 3. * $this->t) * $this->d2 * $this->C5)) / cos($ph1);
        }

        $p->x = Common::adjust_lon($this->long0 + $lam);
        $p->y = $phi;

        return $p;
    }
1167181
def _dist_to_trans(self, dist):
        """"""
        rot, x, y, z = self._quaternion.get_axis_angle()
        tr = MatrixTransform()
        tr.rotate(180 * rot / np.pi, (x, y, z))
        dx, dz, dy = np.dot(tr.matrix[:3, :3], (dist[0], dist[1], 0.))
        return dx, dy, dz
784911
function forward$16(p) {

        var lon = p.x;
        var lat = p.y;

        var dlon = adjust_lon(lon - this.long0);
        var dlat = adjust_lat(lat - this.lat0);
        p.x = this.x0 + (this.a * dlon * this.rc);
        p.y = this.y0 + (this.a * dlat);
        return p;
    }
99280
function(lon, lat) {
        var gLatLng;
        if(this.sphericalMercator) {
            var lonlat = this.inverseMercator(lon, lat);
            gLatLng = new google.maps.LatLng(lonlat.lat, lonlat.lon);
        } else {
            gLatLng = new google.maps.LatLng(lat, lon);
        }
        return gLatLng;
    }
1074259
def xyz2lonlat(x__, y__, z__):
    
    R = 6370997.0
    lons = da.rad2deg(da.arccos(x__ / da.sqrt(x__ ** 2 + y__ ** 2))) * da.sign(y__)
    lats = da.sign(z__) * (90 - da.rad2deg(da.arcsin(da.sqrt(x__ ** 2 + y__ ** 2) / R)))

    return lons, lats
1266152
def tinygps_to_degdec(lat, lng):
    """"""
    x = float(lat[:-5] + '.' + lat[-5:])
    y = float(lng[:-5] + '.' + lng[-5:])

    return x, y
16191
def _co_moving2angle_source(self, x, y):
        
        T_z = self._T_z_source
        theta_x = x / T_z
        theta_y = y / T_z
        return theta_x, theta_y
640257
function forward$8(p) {
        var lon = p.x;
        var lat = p.y;
        var dlon = adjust_lon(lon - this.long0);
        var us, vs;
        var con;
        if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
            if (lat > 0) {
                con = -1;
            }
            else {
                con = 1;
            }
            vs = this.al / this.bl * Math.log(Math.tan(FORTPI + con * this.gamma0 * 0.5));
            us = -1 * con * HALF_PI * this.al / this.bl;
        }
        else {
            var t = tsfnz(this.e, lat, Math.sin(lat));
            var ql = this.el / Math.pow(t, this.bl);
            var sl = 0.5 * (ql - 1 / ql);
            var tl = 0.5 * (ql + 1 / ql);
            var vl = Math.sin(this.bl * (dlon));
            var ul = (sl * Math.sin(this.gamma0) - vl * Math.cos(this.gamma0)) / tl;
            if (Math.abs(Math.abs(ul) - 1) <= EPSLN) {
                vs = Number.POSITIVE_INFINITY;
            }
            else {
                vs = 0.5 * this.al * Math.log((1 - ul) / (1 + ul)) / this.bl;
            }
            if (Math.abs(Math.cos(this.bl * (dlon))) <= EPSLN) {
                us = this.al * this.bl * (dlon);
            }
            else {
                us = this.al * Math.atan2(sl * Math.cos(this.gamma0) + vl * Math.sin(this.gamma0), Math.cos(this.bl * dlon)) / this.bl;
            }
        }

        if (this.no_rot) {
            p.x = this.x0 + us;
            p.y = this.y0 + vs;
        }
        else {

            us -= this.uc;
            p.x = this.x0 + vs * Math.cos(this.alpha) + us * Math.sin(this.alpha);
            p.y = this.y0 + us * Math.cos(this.alpha) - vs * Math.sin(this.alpha);
        }
        return p;
    }
453364
function inverse$15(p) {
        p.x -= this.x0;
        p.y -= this.y0;
        var lon, lat;

        if (this.sphere) {
            lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));
            lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));
        }
        else {
            lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);
            lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));
        }

        p.x = lon;
        p.y = lat;
        return p;
    }
103978
function forward(p) {
        var lon = p.x;
        var lat = p.y;
        // convert to radians
        if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {
            return null;
        }

        var x, y;
        if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
            return null;
        }
        else {
            if (this.sphere) {
                x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
                y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));
            }
            else {
                var sinphi = Math.sin(lat);
                var ts = tsfnz(this.e, lat, sinphi);
                x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
                y = this.y0 - this.a * this.k0 * Math.log(ts);
            }
            p.x = x;
            p.y = y;
            return p;
        }
    }
501036
def _at(self, t):
        """"""
        pos, vel = terra(self.latitude.radians, self.longitude.radians,
                         self.elevation.au, t.gast)
        pos = einsum('ij...,j...->i...', t.MT, pos)
        vel = einsum('ij...,j...->i...', t.MT, vel)
        if self.x:
            R = rot_y(self.x * ASEC2RAD)
            pos = einsum('ij...,j...->i...', R, pos)
        if self.y:
            R = rot_x(self.y * ASEC2RAD)
            pos = einsum('ij...,j...->i...', R, pos)
        # TODO: also rotate velocity

        return pos, vel, pos, None
641964
public void equiToLatLon(double x , double y , GeoLL_F64 geo ) {
		geo.lon = (x/width - 0.5)*GrlConstants.PI2;
		geo.lat = (y/(height-1) - 0.5)*GrlConstants.PI;
	}
468218
function inverse$16(p) {

        var x = p.x;
        var y = p.y;

        p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));
        p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));
        return p;
    }