getUrl method

String getUrl(
  1. Coords<num> coords,
  2. int tileSize,
  3. bool retinaMode
)

Implementation

String getUrl(Coords coords, int tileSize, bool retinaMode) {
  final tileSizePoint = CustomPoint(tileSize, tileSize);
  final nvPoint = coords.scaleBy(tileSizePoint);
  final sePoint = nvPoint + tileSizePoint;
  final nvCoords = crs.pointToLatLng(nvPoint, coords.z as double)!;
  final seCoords = crs.pointToLatLng(sePoint, coords.z as double)!;
  final nv = crs.projection.project(nvCoords);
  final se = crs.projection.project(seCoords);
  final bounds = Bounds(nv, se);
  final bbox = (_versionNumber >= 1.3 && crs is Epsg4326)
      ? [bounds.min.y, bounds.min.x, bounds.max.y, bounds.max.x]
      : [bounds.min.x, bounds.min.y, bounds.max.x, bounds.max.y];

  final buffer = StringBuffer(_encodedBaseUrl);
  buffer.write('&width=${retinaMode ? tileSize * 2 : tileSize}');
  buffer.write('&height=${retinaMode ? tileSize * 2 : tileSize}');
  buffer.write('&bbox=${bbox.join(',')}');
  return buffer.toString();
}