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-08-31 (世界標準時間)。"],[[["\u003cp\u003eThe Maps SDK for iOS utilizes four coordinate systems: latitude/longitude, world, pixel, and tile coordinates, to pinpoint locations on the map.\u003c/p\u003e\n"],["\u003cp\u003eWorld coordinates, derived from latitude/longitude using the Mercator projection, represent points on the map and are independent of zoom level.\u003c/p\u003e\n"],["\u003cp\u003ePixel 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.\u003c/p\u003e\n"],["\u003cp\u003eTile 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.\u003c/p\u003e\n"],["\u003cp\u003eThe API utilizes these coordinate systems to translate between real-world locations and their corresponding representations on the map, enabling accurate display and navigation.\u003c/p\u003e\n"]]],["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"],null,["Select platform: [Android](/maps/documentation/android-sdk/coordinates \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/coordinates \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/coordinates \"View this page for the JavaScript platform docs.\")\n\nThe Maps SDK for iOS uses the following coordinate systems:\n\n- Latitude and longitude values, which reference a point on the world uniquely. (Google uses the [World Geodetic\n System WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System) standard.)\n- World coordinates, which reference a point on the map uniquely.\n- Pixel coordinates, which reference a specific pixel on the map at a specific zoom level.\n- Tile coordinates, which reference a specific tile on the map at a specific zoom level.\n\nWorld coordinates\n\nWhenever the API needs to translate a location in the world to a location on\na map, it first translates latitude and longitude values into a\n*world* coordinate. The API uses the\n[Mercator\nprojection](https://en.wikipedia.org/wiki/Mercator_projection) to perform this translation.\n\nFor convenience in the calculation of pixel coordinates (see below)\nwe assume a map at zoom level 0 is a single tile of the base tile size.\nWe then define world coordinates relative to pixel coordinates at zoom\nlevel 0, using the projection to convert latitudes and longitudes to\npixel positions on this base tile. This world coordinate is a floating\npoint value measured from the origin of the map projection to the\nspecific location. Note that since this value is a floating point value,\nit may be much more precise than the current resolution of the map image\nbeing shown. A world coordinate is independent of the current zoom level,\nin other words.\n\nWorld coordinates in Google Maps are measured from the Mercator\nprojection's origin (the northwest corner of the map at 180 degrees\nlongitude and approximately 85 degrees latitude) and increase in\nthe `x` direction towards the east (right) and increase in\nthe `y` direction towards the south (down). Because the\nbasic Mercator Google Maps tile is 256 x 256 pixels, the usable\nworld coordinate space is `{0-256}, {0-256}`.\n\nNote that a Mercator projection has a finite\nwidth longitudinally but an infinite height latitudinally. We cut off\nbase map imagery utilizing the Mercator projection at approximately\n+/- 85 degrees to make the resulting map shape square, which allows\neasier logic for tile selection. Note that a projection may produce\nworld coordinates outside the base map's usable coordinate space\nif you plot very near the poles, for example.\n\nPixel coordinates\n\n*Pixel coordinates* reference a specific pixel on the map at a\nspecific zoom level, whereas world coordinates reflect absolute locations on a\ngiven projection. Pixel coordinates are calculated using the following\nformula: \n\n```scdoc\npixelCoordinate = worldCoordinate * 2zoomLevel\n```\n\nFrom the above equation, note that each increasing zoom level\nis twice as large in both the `x` and `y`\ndirections. Therefore, each higher zoom level results in a resolution four\ntimes higher than the preceding level. For example, at zoom level 1,\nthe map consists of 4 256x256 pixels tiles, resulting in a pixel space\nfrom 512x512. At zoom level 19, each `x` and `y` pixel\non the map can be referenced using a value between\n0 and 256 \\* 2^19^.\n\nBecause we based world coordinates on the map's tile size, a\npixel coordinate's integer part has the effect of identifying the exact pixel\nat that location in the current zoom level. Note that for zoom level 0, the\npixel coordinates are equal to the world coordinates.\n\nWe now have a way to accurately denote each location on the map,\nat each zoom level. The Maps SDK for iOS constructs a viewport\ngiven the zoom level center of the map (as a `LatLng`) and the\nsize of the containing DOM element, and\ntranslates this bounding box into pixel coordinates. The API then determines\nlogically all map tiles which lie within the given pixel bounds. Each of\nthese map tiles are referenced using [tile coordinates](#tile-coordinates) which greatly simplify the displaying of map\nimagery.\n\nTile coordinates\n\nThe API cannot load all the map imagery at once for the higher zoom levels.\nInstead, the API breaks up the imagery at each zoom level\ninto a set of map tiles, which are logically arranged in an order which the\napplication understands. When a map scrolls to a new location, or to a new\nzoom level, the API determines which tiles are needed\nusing pixel coordinates, and translates those values into a set\nof tiles to retrieve. These tile coordinates are assigned using\na scheme which makes it logically easy to determine which tile contains\nthe imagery for any given point.\n\nTiles in Google Maps are numbered from the same origin as that\nfor pixels. For Google's implementation of the Mercator projection, the\norigin tile is always at the northwest corner\nof the map, with `x` values increasing from west to\neast and `y` values increasing from north to south. Tiles\nare indexed using `x,y` coordinates from that origin. For\nexample, at zoom level 2, when the earth is divided up into 16 tiles,\neach tile can be referenced by a unique `x,y` pair:\n\nNote that by dividing the pixel coordinates by the tile size (256) and\ntaking the integer parts of the result, you produce as a by-product\nthe tile coordinate at the current zoom level.\n\nExample\n\nThe following example displays coordinates for Chicago, IL:\nlatitude/longitude values, world coordinates, pixel coordinates, and tile\ncoordinates. Use the zoom control to see the coordinate values at various\nzoom levels.\n\nTo see how the coordinates were calculated,\n[view\nthe code](/maps/documentation/javascript/examples/map-coordinates)."]]