project method

  1. @override
UPoint project(
  1. LatLng? position
)
override

Projects geographical coordinates into coordinates in units accepted for this CRS (e.g. meters for EPSG:3857, for passing it to WMS services).

Implementation

@override
UPoint project(LatLng? position) {
  double d = PI / 180;
  double y = position!.lat * d;
  double tmp = R_MINOR / R;
  double e = math.sqrt(1 - tmp * tmp);
  double con = e * math.sin(y);

  double ts =
      math.tan(PI / 4 - y / 2) / math.pow((1 - con) / (1 + con), e / 2);
  y = -R * math.log(math.max(ts, 1E-10));

  return UPoint(position.lng * d * R, y);
}