getStaticUrlWithPolyline method

Uri getStaticUrlWithPolyline({
  1. required Location point1,
  2. required Location point2,
  3. num? zoomLevel,
  4. int? width,
  5. int? height,
  6. Location? center,
  7. int? bearing,
  8. int? pitch,
  9. MapBoxStyle? style,
  10. bool? render2x,
  11. bool? auto,
  12. @Deprecated('Please use `markerUrl1` and `markerUrl2` instead') String? markerUrl,
  13. MapBoxPath? path,
  14. MapBoxMarker? marker1,
  15. String? markerUrl1,
  16. MapBoxMarker? marker2,
  17. String? markerUrl2,
})

Retrieve a map with two points and a polyline overlay,

When auto is set to true, the map will adjust automatically to fit the provided markers and paths.

If auto is true then center, zoomLevel, pitch will be ignored.

render2x is used to render the map at 2x scale.

marker1 and marker2 are used to render a custom markers.

markerUrl1 and markerUrl2 are used to render a custom markers using a image/marker url.

If both marker1 and markerUrl1 are provided then marker1 will be used.

Implementation

Uri getStaticUrlWithPolyline({
  required Location point1,
  required Location point2,
  num? zoomLevel,
  int? width,
  int? height,
  Location? center,

  ///rotates the map around its center(from -180 to 180)
  int? bearing,

  ///tilts the map (perspective effect)(from 0 to 60)
  int? pitch,
  MapBoxStyle? style,

  ///@2x renders the map at 2x scale
  bool? render2x,

  /// ignore all customization and adjust map automatically
  bool? auto,

  ///Custom Marker url
  @Deprecated('Please use `markerUrl1` and  `markerUrl2` instead')
      String? markerUrl,
  MapBoxPath? path,
  MapBoxMarker? marker1,
  String? markerUrl1,
  MapBoxMarker? marker2,
  String? markerUrl2,
}) {
  String pinUrl1 = marker1 == null
      ? _generateMarkerLink(
          markerUrl1 ?? markerUrl ?? _defaultMarker.toString())
      : marker1.toString();

  String pinUrl2 = marker2 == null
      ? _generateMarkerLink(
          markerUrl2 ?? markerUrl ?? _defaultMarker.toString())
      : marker2.toString();

  Uri uri = _buildBaseUri(style: style);

  uri = uri.replace(
      path: uri.path +
          "/$pinUrl1(${point1.asString}),$pinUrl2(${point2.asString}),${path ?? _defaultPath}");

  uri = _buildParams(uri,
      bearing: bearing,
      center: center,
      height: height,
      pitch: pitch,
      render2x: render2x,
      width: width,
      zoomLevel: zoomLevel,
      auto: auto);

  return uri;
}