熱視圖
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
heatmapTiles
端點會透過圖塊疊加層提供空氣品質相關熱視圖。圖塊疊加層是一組 PNG 圖片圖塊,可顯示在 Google 地圖上方。每個圖片圖塊都是 256 x 256 像素。
關於熱視圖方塊
圖塊疊加層是由一組圖塊組成的格線,每個圖塊都已指派 (X
,Y
) 座標。座標為 (0,0) 的圖塊一律位於地圖的西北角。X
值會從西到東遞增,Y
值則從北到南遞增。
zoom level
可決定地圖內容在地圖檢視畫面中的大小。圖塊格線大小取決於將 X
和 Y
座標依縮放等級指數縮放。
gridSizeX = XzoomLevel
gridSizeY = YzoomLevel
舉例來說,縮放等級為 2 時,世界地圖會以 4 x 4 矩陣表示,總共 16 個圖塊。縮放比例也會決定座標允許的最大值。
下圖顯示縮放等級為 2 的 US_AQI
熱度圖,以及每個圖塊的座標:

詳情請參閱「地圖與圖塊座標」。
關於熱視圖端點
熱視圖圖塊以位元組陣列表示,其中包含圖塊資料做為 PNG 圖片。您可以使用 heatmapTiles
端點,將 HTTP GET 要求傳送至下列網址,要求取得目前的空氣品質熱度圖圖塊:
https://airquality.googleapis.com/v1/mapTypes/TYPE/heatmapTiles/Z/X/Y?key=YOUR_API_KEY
要求中必須包含所有要求參數:
TYPE
- 要傳回的熱視圖類型。請參閱允許的值。
Z
- 縮放等級,決定地圖內容在地圖檢視畫面中的大小。有效值為 0 至 16,其中值為 0 時,整個世界會顯示在單一圖塊中。
X
、Y
- 要擷取的圖塊座標,以西北角 (0,0) 為基準。X
值會從西到東遞增,Y
值則從北到南遞增。
圖塊座標必須適用於指定的縮放等級。
舉例來說,如果您將縮放等級設為 2,並要求座標為 10,10 的圖塊,API 就會傳回錯誤。
YOUR_API_KEY
- 應用程式的 API 金鑰。這個金鑰會識別您的應用程式,以利配額管理。詳情請參閱「取得金鑰」。
熱視圖要求範例
上圖顯示縮放等級為 2 的 US_AQI
熱視圖,以及每個圖塊的座標。以下範例使用 heatmapTiles
端點,從熱度圖要求座標 0,1 的圖塊:
https://airquality.googleapis.com/v1/mapTypes/US_AQI/heatmapTiles/2/0/1?key=YOUR_API_KEY
圖塊會顯示為:

如要進一步瞭解如何在預設地圖上疊加圖塊,請參閱「疊加層地圖類型」。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間:2025-08-31 (世界標準時間)。"],[[["\u003cp\u003eThe \u003ccode\u003eheatmapTiles\u003c/code\u003e endpoint delivers air quality heatmaps as a tile overlay, which is a collection of PNG images displayed on top of a Google Map.\u003c/p\u003e\n"],["\u003cp\u003eEach tile within the overlay has specific (X, Y) coordinates, with (0,0) at the northwest corner and increasing values eastward (X) and southward (Y), determined by the zoom level.\u003c/p\u003e\n"],["\u003cp\u003eThe zoom level (0-16) controls the map's scale and the tile grid size, with higher zoom levels showing more detailed areas.\u003c/p\u003e\n"],["\u003cp\u003eTo request a heatmap tile, you need to provide the heatmap type, zoom level (Z), tile coordinates (X, Y), and your API key in the request URL.\u003c/p\u003e\n"],["\u003cp\u003eYou can overlay these heatmap tiles on top of the default map using methods described in the provided documentation for a comprehensive air quality visualization.\u003c/p\u003e\n"]]],[],null,["The\n[`heatmapTiles`](/maps/documentation/air-quality/reference/rest/v1/mapTypes.heatmapTiles/lookupHeatmapTile)\nendpoint provides air quality related heatmaps through a tile overlay. A tile\noverlay is a collection of PNG image tiles that can be displayed on top of a\nGoogle Maps. Each image tile is (256 x 256 pixels).\n\nAbout heatmap tiles\n\nThe tile overlay is a grid assembled from a collection of tiles,\neach assigned (`X`,`Y`) coordinates.\nThe tile with coordinates (0,0) is always at the northwest corner\nof the map. The `X` values increase from west to east,\nwhile the `Y` values increase from north to south.\n\nThe `zoom level` determines how large or small the contents of a map appear in a\nmap view. The tile grid size is determined by scaling the `X` and `Y`\ncoordinates exponentially by the zoom level. \n\n```text\ngridSizeX = XzoomLevel\ngridSizeY = YzoomLevel\n```\n\nFor example, at a zoom level of 2, the world map is represented using a 4 x 4\nmatrix, for a total of 16 tiles. The zoom also determines what is the max value\nallowed for the coordinates.\n\nThe following image shows a `US_AQI` heatmap with a zoom level of 2,\nalong with the coordinates of each tile:\n\nSee [Map and Tile coordinates](/maps/documentation/javascript/coordinates)\nfor additional details.\n\nAbout the heatmap endpoint\n\nA heatmap tile is represented by a bytes array containing the tile data as a PNG\nimage. You request current air quality heatmap tiles using the\n[`heatmapTiles`](/maps/documentation/air-quality/reference/rest/v1/mapTypes.heatmapTiles/lookupHeatmapTile)\nendpoint by sending an HTTP GET request to: \n\n```html\nhttps://airquality.googleapis.com/v1/mapTypes/TYPE/heatmapTiles/Z/X/Y?key=YOUR_API_KEY\n```\n\nAll request parameters are required in a request:\n\n- `TYPE` - The type heatmap to return. See [allowed\n values](/maps/documentation/air-quality/reference/rest/v1/mapTypes.heatmapTiles/lookupHeatmapTile#maptype).\n\n- `Z` - Zoom level that determines how large or small the contents of a map\n appear in a map view. Allowed values are 0-16, where a value of 0 displays\n the entire world in a single tile.\n\n- `X`,`Y` - The coordinates of the tile to retrieve, relative to the north\n west corner (0,0). `X` values are increasing from west to east and `Y`\n values are increasing from north to south.\n\n Tile coordinates have to be valid for the specified zoom level.\n For example, if you set the zoom level to 2, and request a tile at\n coordinates of 10,10, the API returns an error.\n- `YOUR_API_KEY` - Your application's API key. This key identifies your\n application for purposes of quota management. For more information, see [get\n a key](/maps/documentation/air-quality/get-api-key).\n\nExample heatmap request\n\nThe image above shows a `US_AQI` heatmap with a zoom level of 2,\nalong with the coordinates of each tile. The following example uses the\n`heatmapTiles` endpoint to request the tile at coordinates 0,1 from the\nheatmap: \n\n```html\nhttps://airquality.googleapis.com/v1/mapTypes/US_AQI/heatmapTiles/2/0/1?key=YOUR_API_KEY\n```\n\nThe tile appears as:\n\nFor more information on overlaying tiles on top of the default map, see\n[Overlay Map Types](/maps/documentation/javascript/examples/maptype-overlay)."]]