azure.maps.render.aio package

class azure.maps.render.aio.MapsRenderClient(credential: Union[azure.core.credentials.AzureKeyCredential, azure.core.credentials_async.AsyncTokenCredential], **kwargs: Any)[source]

Azure Maps Render REST APIs.

Parameters

credential (AsyncTokenCredential or AzureKeyCredential) – Credential needed for the client to connect to Azure.

Keyword Arguments

api_version (str) – The API version of the service to use for requests. It defaults to the latest service version. Setting to an older version may result in reduced feature compatibility.

Example:

Creating the MapsRenderClient with an subscription key.
from azure.core.credentials import AzureKeyCredential
from azure.maps.render.aio import MapsRenderClient

subscription_key = os.getenv("AZURE_SUBSCRIPTION_KEY")

maps_render_client = MapsRenderClient(credential=AzureKeyCredential(subscription_key))
Creating the MapsRenderClient with a token credential.
from azure.identity.aio import DefaultAzureCredential
from azure.maps.render.aio import MapsRenderClient

credential = DefaultAzureCredential()
maps_client_id = os.getenv("AZURE_MAPS_CLIENT_ID")

maps_render_client = MapsRenderClient(client_id=maps_client_id, credential=credential)

Copyrights API is designed to serve copyright information for Render Tile service. In addition to basic copyright for the whole map, API is serving specific groups of copyrights for some countries.

As an alternative to copyrights for map request, one can receive captions for displaying the map provider information on the map.

Returns

Get Copyright Caption Result

Return type

CopyrightCaption

Raises

~azure.core.exceptions.HttpResponseError

Example:

Return serve copyright information for Render Tile service.
from azure.core.credentials import AzureKeyCredential
from azure.maps.render.aio import MapsRenderClient

maps_render_client = MapsRenderClient(credential=AzureKeyCredential(subscription_key))

async with maps_render_client:
    result = await maps_render_client.get_copyright_caption()

print("Get copyright caption result:")
print(result.copyrights_caption)

Copyrights API is designed to serve copyright information for Render Tile service. In addition to basic copyright for the whole map, API is serving specific groups of copyrights for some countries. Returns the copyright information for a given tile. To obtain the copyright information for a particular tile, the request should specify the tile’s zoom level and x and y coordinates (see: Zoom Levels and Tile Grid).

Parameters
  • z (int) – Zoom level for the desired tile.

  • x (int) – X coordinate of the tile on zoom grid.

  • y (int) – Y coordinate of the tile on zoom grid.

Keyword Arguments

include_text (bool) – True or False to exclude textual data from response. Only images and country names will be in response.

Returns

Copyright result

Return type

Copyright

Raises

HttpResponseError

Example:

Returns the copyright information for a given tile.
from azure.core.credentials import AzureKeyCredential
from azure.maps.render.aio import MapsRenderClient

maps_render_client = MapsRenderClient(credential=AzureKeyCredential(subscription_key))

async with maps_render_client:
    result = await maps_render_client.get_copyright_for_tile(z=6, x=9, y=22)

print("Get copyright for tile result:")
print(result.general_copyrights[0])

Copyrights API is designed to serve copyright information for Render Tile service. In addition to basic copyright for the whole map, API is serving specific groups of copyrights for some countries. Returns the copyright information for the world. To obtain the default copyright information for the whole world, do not specify a tile or bounding box.

Keyword Arguments

include_text (bool) – True or False to exclude textual data from response. Only images and country names will be in response.

Returns

Copyright result

Return type

Copyright

Raises

HttpResponseError

Example:

Returns the copyright information for the world.
from azure.core.credentials import AzureKeyCredential
from azure.maps.render.aio import MapsRenderClient

maps_render_client = MapsRenderClient(credential=AzureKeyCredential(subscription_key))

async with maps_render_client:
    result = await maps_render_client.get_copyright_for_world()

print("Get copyright for the world result:")
print(result.general_copyrights[0])

Returns copyright information for a given bounding box. Bounding-box requests should specify the minimum and maximum longitude and latitude (EPSG-3857) coordinates.

Parameters

bounding_box – north(top), west(left), south(bottom), east(right) position of the bounding box as float. E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57)

Type

BoundingBox

Keyword Arguments

include_text (bool) – True or False to exclude textual data from response. Only images and country names will be in response.

Returns

Copyright result

Return type

Copyright

Raises

HttpResponseError

Example:

async get_map_attribution(tileset_id: Union[str, azure.maps.render._generated.models._enums.TilesetID], zoom: int, bounds: azure.maps.render.models._models.BoundingBox, **kwargs: Any)azure.maps.render._generated.models._models.MapAttribution[source]

The Get Map Attribution API allows users to request map copyright attribution information for a section of a tileset.

Parameters
  • tileset_id (str or TilesetID) – A tileset is a collection of raster or vector data broken up into a uniform grid of square tiles at preset zoom levels. Every tileset has a tilesetId to use when making requests.

  • zoom (int) – Zoom level for the desired map attribution.

  • bounds (BoundingBox) – north(top), west(left), south(bottom), east(right) position of the bounding box as float. E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57)

Returns

MapAttribution

Return type

MapAttribution

Raises

HttpResponseError

Example:

Return map copyright attribution information for a section of a tileset.
from azure.core.credentials import AzureKeyCredential
from azure.maps.render.aio import MapsRenderClient
from azure.maps.render.models import TilesetID, BoundingBox

maps_render_client = MapsRenderClient(credential=AzureKeyCredential(subscription_key))

async with maps_render_client:
    result = await maps_render_client.get_map_attribution(
        tileset_id=TilesetID.MICROSOFT_BASE,
        zoom=6,
        bounds=BoundingBox(
            south=42.982261,
            west=24.980233,
            north=56.526017,
            east=1.355233
        )
    )

print("Get map attribution result:")
print(result.copyrights[0])
async get_map_state_tile(stateset_id: str, z: int, x: int, y: int, **kwargs: Any)AsyncIterator[bytes][source]

Fetches state tiles in vector format typically to be integrated into indoor maps module of map control or SDK.

Parameters
  • z (int) – Zoom level for the desired tile.

  • x (int) – X coordinate of the tile on zoom grid.

  • y (int) – Y coordinate of the tile on zoom grid.

  • stateset_id (str) – The stateset id.

Returns

AsyncIterator of the response bytes

Return type

AsyncIterator[bytes]

Raises

HttpResponseError

async get_map_static_image(**kwargs: Any)AsyncIterator[bytes][source]

The static image service renders a user-defined, rectangular image containing a map section using a zoom level from 0 to 20. The static image service renders a user-defined, rectangular image containing a map section using a zoom level from 0 to 20. The supported resolution range for the map image is from 1x1 to 8192x8192. If you are deciding when to use the static image service over the map tile service, you may want to consider how you would like to interact with the rendered map. If the map contents will be relatively unchanging, a static map is a good choice. If you want to support a lot of zooming, panning and changing of the map content, the map tile service would be a better choice.

Keyword Arguments
  • img_format (str or RasterTileFormat) – Desired format of the response. Possible value: png. “png” Default value is “png”.

  • layer (str or StaticMapLayer) – Map layer requested.

  • style (str or MapImageStyle) – Map style to be returned.

  • zoom (int) – Desired zoom level of the map.

  • center (LatLon or Tuple) – Coordinates of the center point.

  • bounding_box_private (BoundingBox) – north(top), west(left), south(bottom), east(right) position of the bounding box as float. E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57)

  • height (int) – Height of the resulting image in pixels. Range is 1 to 8192.

  • width (int) – Width of the resulting image in pixels. Range is 1 to 8192. Default is 512.

  • language (str) – Language in which search results should be returned.

  • localized_map_view (str or LocalizedMapView) – The View parameter (also called the “user region” parameter) allows you to show the correct maps for a certain country/region for geopolitically disputed regions.

  • pins (list[str] or ImagePushpinStyle) – Pushpin style and instances. Use this parameter to optionally add pushpins to the image.

  • path (list[str] or ImagePathStyle) – Path style and locations. Use this parameter to optionally add lines, polygons or circles to the image.

Returns

AsyncIterator of the response bytes

Return type

AsyncIterator[bytes]

Raises

HttpResponseError

Example:

Return static image service renders a user-defined, rectangular image containing a map section using a zoom level from 0 to 20.
from azure.core.credentials import AzureKeyCredential
from azure.maps.render.aio import MapsRenderClient

maps_render_client = MapsRenderClient(credential=AzureKeyCredential(subscription_key))

async with maps_render_client:
    result = await maps_render_client.get_map_static_image(img_format="png", center=(52.41064,4.84228))
async get_map_tile(tileset_id: Union[str, azure.maps.render._generated.models._enums.TilesetID], z: int, x: int, y: int, **kwargs: Any)AsyncIterator[bytes][source]

The Get Map Tiles API allows users to request map tiles in vector or raster formats typically to be integrated into a map control or SDK. Some example tiles that can be requested are Azure Maps road tiles, real-time Weather Radar tiles. By default, Azure Maps uses vector tiles for its web map control (Web SDK) and Android SDK.

Parameters
  • tileset_id (str or TilesetID) – A tileset is a collection of raster or vector data broken up into a uniform grid of square tiles at preset zoom levels. Every tileset has a tilesetId to use when making requests.

  • z (int) – Zoom level for the desired tile.

  • x (int) – X coordinate of the tile on zoom grid.

  • y (int) – Y coordinate of the tile on zoom grid.

Keyword Arguments
  • time_stamp (datetime) – The desired date and time of the requested tile.

  • tile_size (MapTileSize) – The size of the returned map tile in pixels.

  • language (str) – Language in which search results should be returned.

  • localized_map_view (str or LocalizedMapView) – The View parameter (also called the “user region” parameter) allows you to show the correct maps for a certain country/region for geopolitically disputed regions.

Returns

AsyncIterator of the response bytes

Return type

AsyncIterator[bytes]

Raises

HttpResponseError

Example:

Return map tiles in vector or raster formats.
from azure.core.credentials import AzureKeyCredential
from azure.maps.render.aio import MapsRenderClient
from azure.maps.render.models import TilesetID

maps_render_client = MapsRenderClient(credential=AzureKeyCredential(subscription_key))


async with maps_render_client:
    result = await maps_render_client.get_map_tile(tileset_id=TilesetID.MICROSOFT_BASE, z=6, x=9, y=22, tile_size="512")

async get_map_tileset(tileset_id: Union[str, azure.maps.render._generated.models._enums.TilesetID], **kwargs: Any)azure.maps.render.models._models.MapTileset[source]

The Get Map Tileset API allows users to request metadata for a tileset.

Parameters

tileset_id (str or TilesetID) – A tileset is a collection of raster or vector data broken up into a uniform grid of square tiles at preset zoom levels. Every tileset has a tilesetId to use when making requests.

Returns

MapTileset

Return type

MapTileset

Raises

HttpResponseError

Example: