Skip to content

Commit

Permalink
udpate accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
alextts627 committed Oct 5, 2022
1 parent 87223dd commit 67fba43
Show file tree
Hide file tree
Showing 30 changed files with 323 additions and 151 deletions.
8 changes: 4 additions & 4 deletions sdk/maps/azure-maps-render/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For

### Prerequisites

- Python 3.6 or later is required to use this package.
- Python 3.7 or later is required to use this package.
- An [Azure subscription][azure_subscription] and an [Azure Maps account](https://docs.microsoft.com/azure/azure-maps/how-to-manage-account-keys).
- A deployed Maps Services resource. You can create the resource via [Azure Portal][azure_portal] or [Azure CLI][azure_cli].

Expand Down Expand Up @@ -140,9 +140,9 @@ from azure.maps.render import MapsRenderClient

result = maps_render_client.get_map_tile(
tileset_id=TilesetID.MICROSOFT_BASE,
tile_index_z=6,
tile_index_x=9,
tile_index_y=22,
z=6,
x=9,
y=22,
tile_size="512"
)
```
Expand Down
104 changes: 60 additions & 44 deletions sdk/maps/azure-maps-render/azure/maps/render/_render_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# ------------------------------------

# pylint: disable=unused-import,ungrouped-imports, R0904, C0302
from typing import TYPE_CHECKING, overload, Union, Any, List, Optional, Iterator
from typing import TYPE_CHECKING, overload, Union, Any, List, Optional, Iterator, Tuple
from azure.core.tracing.decorator import distributed_trace
from azure.core.exceptions import HttpResponseError
from azure.core.credentials import AzureKeyCredential, TokenCredential
Expand All @@ -17,7 +17,6 @@
TilesetID,
Copyright,
MapTileset,
MapAttribution,
CopyrightCaption,
RasterTileFormat
)
Expand Down Expand Up @@ -60,9 +59,9 @@ def __init__(
def get_map_tile(
self,
tileset_id: Union[str, TilesetID],
tile_index_z: int,
tile_index_x: int,
tile_index_y: int,
x: int,
y: int,
z: int,
**kwargs: Any
) -> Iterator[bytes]:
"""The Get Map Tiles API allows users to request map tiles in vector or raster formats typically
Expand All @@ -76,15 +75,15 @@ def get_map_tile(
when making requests.
:type tileset_id:
str or ~azure.maps.render.models.TilesetID
:param tile_index_z:
:param z:
Zoom level for the desired tile.
:type tile_index_z: int
:param tile_index_x:
:type z: int
:param x:
X coordinate of the tile on zoom grid.
:type tile_index_x: int
:param tile_index_y:
:type x: int
:param y:
Y coordinate of the tile on zoom grid.
:type tile_index_y: int
:type y: int
:keyword time_stamp:
The desired date and time of the requested tile.
:paramtype time_stamp: ~datetime.datetime
Expand Down Expand Up @@ -116,9 +115,9 @@ def get_map_tile(

return self._render_client.get_map_tile(
tileset_id=tileset_id,
z=tile_index_z,
x=tile_index_x,
y=tile_index_y,
z=z,
x=x,
y=y,
**kwargs
)

Expand Down Expand Up @@ -150,11 +149,28 @@ def get_map_tileset(
:dedent: 4
:caption: Return metadata for a tileset.
"""
return self._render_client.get_map_tileset(
result = self._render_client.get_map_tileset(
tileset_id=tileset_id,
**kwargs
)

return MapTileset(
name = result.name,
description = result.description,
version = result.version,
template = result.template,
legend = result.legend,
scheme = result.scheme,
min_zoom = result.min_zoom,
max_zoom = result.max_zoom,
bounds = result.bounds,
center = result.center,
map_attribution=result.attribution,
tilejson_version=result.tilejson,
tiles_endpoints=result.tiles,
grid_endpoints=result.grids,
data_files=result.data
)

@distributed_trace
def get_map_attribution(
Expand All @@ -163,7 +179,7 @@ def get_map_attribution(
zoom: int,
bounds: BoundingBox,
**kwargs: Any
) -> MapAttribution:
) -> List[str]:
"""The Get Map Attribution API allows users to request map copyright attribution information for a
section of a tileset.
Expand All @@ -180,8 +196,8 @@ def get_map_attribution(
position of the bounding box as float.
E.g. BoundingBox(west=37.553, south=-122.453, east=33.2, north=57)
:type bounds: BoundingBox
:return: MapAttribution
:rtype: ~azure.maps.render.models.MapAttribution
:return: List[str]
:rtype: List[str]
:raises ~azure.core.exceptions.HttpResponseError:
.. admonition:: Example:
Expand All @@ -205,29 +221,29 @@ def get_map_attribution(
zoom=zoom,
bounds=bounds,
**kwargs
)
).copyrights

@distributed_trace
def get_map_state_tile(
self,
stateset_id: str,
tile_index_z: int,
tile_index_x: int,
tile_index_y: int,
x: int,
y: int,
z: int,
**kwargs: Any
) -> Iterator[bytes]:
"""Fetches state tiles in vector format typically to be integrated into indoor maps module of map
control or SDK.
:param tile_index_z:
:param z:
Zoom level for the desired tile.
:type tile_index_z: int
:param tile_index_x:
:type z: int
:param x:
X coordinate of the tile on zoom grid.
:type tile_index_x: int
:param tile_index_y:
:type x: int
:param y:
Y coordinate of the tile on zoom grid.
:type tile_index_y: int
:type y: int
:param stateset_id:
The stateset id.
:type stateset_id: str
Expand All @@ -238,9 +254,9 @@ def get_map_state_tile(

return self._render_client.get_map_state_tile(
stateset_id=stateset_id,
z=tile_index_z,
x=tile_index_x,
y=tile_index_y,
z=z,
x=x,
y=y,
**kwargs
)

Expand Down Expand Up @@ -304,7 +320,7 @@ def get_map_static_image(
:paramtype zoom: int
:keyword center:
Coordinates of the center point.
:paramtype center: LatLon
:paramtype center: LatLon or Tuple
:keyword BoundingBox bounding_box_private:
north(top), west(left), south(bottom), east(right)
position of the bounding box as float.
Expand Down Expand Up @@ -404,9 +420,9 @@ def get_copyright_from_bounding_box(
@distributed_trace
def get_copyright_for_tile(
self,
tile_index_z: int,
tile_index_x: int,
tile_index_y: int,
x: int,
y: int,
z: int,
**kwargs: Any
) -> Copyright:
"""Copyrights API is designed to serve copyright information for Render Tile service. In addition
Expand All @@ -416,15 +432,15 @@ def get_copyright_for_tile(
particular tile, the request should specify the tile's zoom level and x and y coordinates (see:
Zoom Levels and Tile Grid).
:param tile_index_z:
:param z:
Zoom level for the desired tile.
:type tile_index_z: int
:param tile_index_x:
:type z: int
:param x:
X coordinate of the tile on zoom grid.
:type tile_index_x: int
:param tile_index_y:
:type x: int
:param y:
Y coordinate of the tile on zoom grid.
:type tile_index_y: int
:type y: int
:keyword include_text:
True or False to exclude textual data from response. Only images and
country names will be in response.
Expand All @@ -446,9 +462,9 @@ def get_copyright_for_tile(
_include_text=kwargs.pop("include_text", True)

return self._render_client.get_copyright_for_tile(
z=tile_index_z,
x=tile_index_x,
y=tile_index_y,
z=z,
x=x,
y=y,
include_text= "yes" if _include_text else "no",
**kwargs
)
Expand Down
Loading

0 comments on commit 67fba43

Please sign in to comment.