Google 地圖中的世界座標是從麥卡托投影的原點 (地圖的西北角,經度 180 度,緯度約 85 度) 開始測量;向東 (右) 增加 x 向度,向南 (下) 增加 y 向度。基本的麥卡托 Google 地圖圖塊是 256 x 256 像素,因此可用的世界座標空間是 {0-256}, {0-256}。
現在,我們可以在每個縮放等級下,精確表示地圖上的各個位置。Maps SDK for iOS 會建構可視區域
指定地圖的縮放等級中心 (為 LatLng) 和
所含 DOM 元素的大小
會將這個定界框轉譯為像素座標。接下來,API 就可以按照邏輯判斷落在指定像素範圍內的所有地圖圖塊。每個地圖圖塊都可用圖塊座標參照,因此能大幅簡化地圖圖像的顯示作業。
圖塊座標
API 無法在較高的縮放等級下,一次載入所有地圖圖像,而是會將各個縮放等級的圖像,分解成一組依照應用程式理解的邏輯順序排列的地圖圖塊。地圖捲動到新位置或調至新的縮放等級時,API 會使用像素座標來判斷需要哪些圖塊,然後將這些值轉譯成要擷取的一組圖塊。系統會利用一套可依照邏輯輕易判斷的配置指定這些圖塊座標;透過這套配置,即可得知哪些圖塊包含任意特定點的圖像。
Google 地圖中的圖塊是從與像素原點相同的位置開始編號。在 Google 的麥卡托投影實作中,原點圖塊一律位於地圖的西北角,同時 x 值會從西到東遞增,y 值則從北到南遞增。圖塊是使用從該原點開始的 x,y 座標來建立索引。舉例來說,縮放等級為 2 時,如果將地球區分成 16 個圖塊,每個圖塊都可使用不重複的 x,y 組合參照:
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-03-21 (世界標準時間)。"],[[["The Maps SDK for iOS utilizes four coordinate systems: latitude/longitude, world, pixel, and tile coordinates, to pinpoint locations on the map."],["World coordinates, derived from latitude/longitude using the Mercator projection, represent points on the map and are independent of zoom level."],["Pixel coordinates denote specific pixels on the map at a given zoom level and are calculated by multiplying world coordinates by 2 raised to the power of the zoom level."],["Tile coordinates are used to efficiently load map imagery by dividing the map into a grid of tiles, with each tile assigned a unique x,y coordinate based on its position."],["The API utilizes these coordinate systems to translate between real-world locations and their corresponding representations on the map, enabling accurate display and navigation."]]],["The Maps SDK for iOS utilizes latitude/longitude, world, pixel, and tile coordinate systems. World coordinates, based on the Mercator projection, convert latitude/longitude to map locations, independent of zoom. Pixel coordinates reference specific pixels at a zoom level, calculated by multiplying world coordinates by 2 to the power of the zoom level. Tile coordinates, derived from pixel coordinates, divide the map into tiles, enabling the API to retrieve and display only necessary imagery at various zoom levels. Each coordinate type is measured from the northwest corner.\n"]]