getMapSprites method
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.pngfor high pixel density displays
-
sprites.json -
sprites@2x.jsonfor 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'),
);
}