unproject method

  1. @override
LatLng unproject(
  1. UPoint point
)
override

Given a projected coordinate returns the corresponding GeoPosition. The inverse of project.

Implementation

@override
LatLng unproject(UPoint point) {
  double d = 180 / PI;
  double tmp = R_MINOR / R;
  double e = math.sqrt(1 - tmp * tmp);
  double ts = math.exp(-point.y / R);
  double phi = PI / 2 - 2 * math.atan(ts);
  double dphi = 0.1;
  double con = 0;

  for (int i = 0; i < 15 && dphi.abs() > 1e-7; i++) {
    con = e * math.sin(phi);
    con = math.pow((1 - con) / (1 + con), e / 2) as double;
    dphi = PI / 2 - 2 * math.atan(ts * con) - phi;
    phi += dphi;
  }

  return LatLng(wrapLat(phi * d), wrapLng(point.x * d / R));
}