Zone.byLocation constructor

Zone.byLocation(
  1. double lat,
  2. double lon,
  3. int level
)

Implementation

factory Zone.byLocation(double lat, double lon, int level) {
  if (lat < -90 || lat > 90) {
    throw ArgumentError('latitude must be between -90 and 90');
  }
  if (lon < -180 || lon > 180) {
    throw ArgumentError('longitude must be between -180 and 180');
  }
  if (level < 0 || level > 15) {
    throw ArgumentError('level must be between 0 and 15');
  }

  final xy = XY.byLocation(lat, lon, level);
  return Zone.byXY(xy.x!, xy.y!, level);
}