getMapSprites method

Future<GetMapSpritesResponse> getMapSprites({
  1. required String fileName,
  2. required String mapName,
  3. String? key,
})
Retrieves the sprite sheet corresponding to a map resource. The sprite sheet is a PNG image paired with a JSON document describing the offsets of individual icons that will be displayed on a rendered map.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter fileName : The name of the sprite file. Use the following file names for the sprite sheet:

  • sprites.png
  • sprites@2x.png for high pixel density displays
For the JSON document containing image offsets. Use the following file names:
  • sprites.json
  • sprites@2x.json for high pixel density displays

Parameter mapName : The map resource associated with the sprite file.

Parameter key : The optional API key to authorize the request.

Implementation

Future<GetMapSpritesResponse> getMapSprites({
  required String fileName,
  required String mapName,
  String? key,
}) async {
  final $query = <String, List<String>>{
    if (key != null) 'key': [key],
  };
  final response = await _protocol.sendRaw(
    payload: null,
    method: 'GET',
    requestUri:
        '/maps/v0/maps/${Uri.encodeComponent(mapName)}/sprites/${Uri.encodeComponent(fileName)}',
    queryParams: $query,
    hostPrefix: 'maps.',
    exceptionFnMap: _exceptionFns,
  );
  return GetMapSpritesResponse(
    blob: await response.stream.toBytes(),
    cacheControl:
        _s.extractHeaderStringValue(response.headers, 'Cache-Control'),
    contentType:
        _s.extractHeaderStringValue(response.headers, 'Content-Type'),
  );
}