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 max = MAX_LATITUDE;
  double lat = math.max(math.min(max, position!.lat), -max);
  double sin = math.sin(lat * d);

  return UPoint(
    R * position.lng * d,
    R * math.log((1 + sin) / (1 - sin)) / 2,
  );
}