getStyleDescriptor method

Future<GetStyleDescriptorResponse> getStyleDescriptor({
  1. required MapStyle style,
  2. Buildings? buildings,
  3. ColorScheme? colorScheme,
  4. ContourDensity? contourDensity,
  5. String? key,
  6. String? politicalView,
  7. Terrain? terrain,
  8. Traffic? traffic,
  9. List<TravelMode>? travelModes,
})

GetStyleDescriptor returns information about the style.

For more information, see Style dynamic maps in the Amazon Location Service Developer Guide.

Parameter style : Style specifies the desired map style. For GrabMaps customers, ap-southeast-1 and ap-southeast-5 regions support only the Standard and Monochrome values.

Parameter buildings : Adjusts how building details are rendered on the map.

The following building styles are currently supported:

  • Buildings3D: Displays buildings as three-dimensional extrusions on the map.
Buildings3D is valid only for the Standard and Monochrome map styles.

Parameter colorScheme : Sets the color tone for the map, such as dark and light.

Example: Light

Default value: Light

Parameter contourDensity : Displays the shape and steepness of terrain features using elevation lines. The density value controls how densely the available contour line information is rendered on the map. Not supported in ap-southeast-1 and ap-southeast-5 regions for GrabMaps customers.

This parameter is valid for all map styles except Satellite.

Parameter key : Optional: The API key to be used for authorization. Either an API key or valid SigV4 signature must be provided when making a request.

Parameter politicalView : Specifies the political view using ISO 3166-2 or ISO 3166-3 country code format. Not supported in ap-southeast-1 and ap-southeast-5 regions for GrabMaps customers.

The following political views are currently supported:

  • ARG: Argentina's view on the Southern Patagonian Ice Field and Tierra Del Fuego, including the Falkland Islands, South Georgia, and South Sandwich Islands
  • EGY: Egypt's view on Bir Tawil
  • IND: India's view on Gilgit-Baltistan
  • KEN: Kenya's view on the Ilemi Triangle
  • MAR: Morocco's view on Western Sahara
  • RUS: Russia's view on Crimea
  • SDN: Sudan's view on the Halaib Triangle
  • SRB: Serbia's view on Kosovo, Vukovar, and Sarengrad Islands
  • SUR: Suriname's view on the Courantyne Headwaters and Lawa Headwaters
  • SYR: Syria's view on the Golan Heights
  • TUR: Turkey's view on Cyprus and Northern Cyprus
  • TZA: Tanzania's view on Lake Malawi
  • URY: Uruguay's view on Rincon de Artigas
  • VNM: Vietnam's view on the Paracel Islands and Spratly Islands

Parameter terrain : Adjusts how physical terrain details are rendered on the map. Not supported in ap-southeast-1 and ap-southeast-5 regions for GrabMaps customers.

The following terrain styles are currently supported:

  • Hillshade: Displays the physical terrain details through shading and highlighting of elevation change and geographic features.
  • Terrain3D: Displays physical terrain details and elevations as a three-dimensional model.
Hillshade is valid only for the Standard and Monochrome map styles.

Parameter traffic : Displays real-time traffic information overlay on map, such as incident events and flow events. Not supported in ap-southeast-1 and ap-southeast-5 regions for GrabMaps customers.

This parameter is valid for all map styles except Satellite.

Parameter travelModes : Renders additional map information relevant to selected travel modes. Information for multiple travel modes can be displayed simultaneously, although this increases the overall information density rendered on the map. Not supported in ap-southeast-1 and ap-southeast-5 regions for GrabMaps customers.

This parameter is valid for all map styles except Satellite.

Implementation

Future<GetStyleDescriptorResponse> getStyleDescriptor({
  required MapStyle style,
  Buildings? buildings,
  ColorScheme? colorScheme,
  ContourDensity? contourDensity,
  String? key,
  String? politicalView,
  Terrain? terrain,
  Traffic? traffic,
  List<TravelMode>? travelModes,
}) async {
  final $query = <String, List<String>>{
    if (buildings != null) 'buildings': [buildings.value],
    if (colorScheme != null) 'color-scheme': [colorScheme.value],
    if (contourDensity != null) 'contour-density': [contourDensity.value],
    if (key != null) 'key': [key],
    if (politicalView != null) 'political-view': [politicalView],
    if (terrain != null) 'terrain': [terrain.value],
    if (traffic != null) 'traffic': [traffic.value],
    if (travelModes != null)
      'travel-modes': travelModes.map((e) => e.value).toList(),
  };
  final response = await _protocol.sendRaw(
    payload: null,
    method: 'GET',
    requestUri: '/styles/${Uri.encodeComponent(style.value)}/descriptor',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return GetStyleDescriptorResponse(
    blob: await response.stream.toBytes(),
    cacheControl:
        _s.extractHeaderStringValue(response.headers, 'Cache-Control'),
    contentType:
        _s.extractHeaderStringValue(response.headers, 'Content-Type'),
    eTag: _s.extractHeaderStringValue(response.headers, 'ETag'),
  );
}