View a markdown version of this page

如何取得特定維度的靜態映射 - Amazon Location Service

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

如何取得特定維度的靜態映射

在本主題中,您將了解如何使用 Amazon Location Service 設定靜態地圖的維度 (高度和寬度)。自訂地圖影像的維度可讓您平衡效能、視覺品質和可用性。width 和 的最大值height為 1400 像素,而最小值為 64 像素。結果大小上限為 6 MB。

此外,您可以使用 bboxbounds 參數以及 padding ,以確保邊緣附近的重要地圖功能完全可見,不會中斷。

取得具有特定高度和寬度的地圖影像

在此範例中,您將建立芬蘭赫爾辛基的低解析度和中解析度地圖影像。

Request URL for low-resolution thumbnail
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=200&height=200&zoom=11.5&center=24.9460,60.1690&key=API_KEY
Response (Thumbnail 200x200)
芬蘭赫爾辛基的靜態地圖 API 回應,以低解析度顯示最小維度設定。
Request URL for mid-resolution image
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=700&height=700&zoom=13&center=24.9460,60.1690&key=API_KEY
Response image (700x700)
芬蘭赫爾辛基中解析度的靜態地圖 API 回應,顯示與低解析度版本相比的更多細節。

取得對應影像,並在各邊加上填補

在此範例中,您將使用芬蘭赫爾辛基的幾個必看位置來產生地圖,以及其座標 (經度、緯度),無論是否有填補。

Request URL with padding
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&padding=150&bounded-positions=24.9526,60.1692,24.9850,60.1465,24.9270,60.1725,24.9226,60.1826,24.9509,60.1675,24.9566,60.1685,24.9457,60.1674,24.9397,60.1719,24.9414,60.1715,24.9387,60.1720&key=API_KEY
Response image (with padding)
套用填補的 Helsinki 靜態地圖 API 回應,在邊界區域周圍顯示額外的空間,以防止特徵在邊緣被截斷。
Request URL without padding
https://maps.geo.eu-central-1.amazonaws.com/v2/static/map?style=Satellite&width=1024&height=1024&bounded-positions=24.9526,60.1692,24.9850,60.1465,24.9270,60.1725,24.9226,60.1826,24.9509,60.1675,24.9566,60.1685,24.9457,60.1674,24.9397,60.1719,24.9414,60.1715,24.9387,60.1720&key=API_KEY
Response image (without padding)
沒有填補的 Helsinki 靜態地圖 API 回應,顯示更緊密的裁剪,其中邊緣特徵可能會部分截斷。