Stay organized with collections Save and categorize content based on your preferences.
The Maps JavaScript API uses the following coordinate systems:
Whenever the API needs to translate a location in the world to a location on a map, it first translates latitude and longitude values into a world coordinate. The API uses the Mercator projection to perform this translation.
For convenience in the calculation of pixel coordinates (see below) we assume a map at zoom level 0 is a single tile of the base tile size. We then define world coordinates relative to pixel coordinates at zoom level 0, using the projection to convert latitudes and longitudes to pixel positions on this base tile. This world coordinate is a floating point value measured from the origin of the map projection to the specific location. Note that since this value is a floating point value, it may be much more precise than the current resolution of the map image being shown. A world coordinate is independent of the current zoom level, in other words.
World coordinates in Google Maps are measured from the Mercator projection's origin (the northwest corner of the map at 180 degrees longitude and approximately 85 degrees latitude) and increase in the x
direction towards the east (right) and increase in the y
direction towards the south (down). Because the basic Mercator Google Maps tile is 256 x 256 pixels, the usable world coordinate space is {0-256}, {0-256}
.
Note that a Mercator projection has a finite width longitudinally but an infinite height latitudinally. We cut off base map imagery utilizing the Mercator projection at approximately +/- 85 degrees to make the resulting map shape square, which allows easier logic for tile selection. Note that a projection may produce world coordinates outside the base map's usable coordinate space if you plot very near the poles, for example.
Pixel coordinatesPixel coordinates reference a specific pixel on the map at a specific zoom level, whereas world coordinates reflect absolute locations on a given projection. Pixel coordinates are calculated using the following formula:
pixelCoordinate = worldCoordinate * 2zoomLevel
From the above equation, note that each increasing zoom level is twice as large in both the x
and y
directions. Therefore, each higher zoom level results in a resolution four times higher than the preceding level. For example, at zoom level 1, the map consists of 4 256x256 pixels tiles, resulting in a pixel space from 512x512. At zoom level 19, each x
and y
pixel on the map can be referenced using a value between 0 and 256 * 219.
Because we based world coordinates on the map's tile size, a pixel coordinate's integer part has the effect of identifying the exact pixel at that location in the current zoom level. Note that for zoom level 0, the pixel coordinates are equal to the world coordinates.
We now have a way to accurately denote each location on the map, at each zoom level. The Maps JavaScript API constructs a viewport given the zoom level center of the map (as a LatLng
) and the size of the containing DOM element, and translates this bounding box into pixel coordinates. The API then determines logically all map tiles which lie within the given pixel bounds. Each of these map tiles are referenced using tile coordinates which greatly simplify the displaying of map imagery.
The API cannot load all the map imagery at once for the higher zoom levels. Instead, the API breaks up the imagery at each zoom level into a set of map tiles, which are logically arranged in an order which the application understands. When a map scrolls to a new location, or to a new zoom level, the API determines which tiles are needed using pixel coordinates, and translates those values into a set of tiles to retrieve. These tile coordinates are assigned using a scheme which makes it logically easy to determine which tile contains the imagery for any given point.
Tiles in Google Maps are numbered from the same origin as that for pixels. For Google's implementation of the Mercator projection, the origin tile is always at the northwest corner of the map, with x
values increasing from west to east and y
values increasing from north to south. Tiles are indexed using x,y
coordinates from that origin. For example, at zoom level 2, when the earth is divided up into 16 tiles, each tile can be referenced by a unique x,y
pair:
Note that by dividing the pixel coordinates by the tile size (256) and taking the integer parts of the result, you produce as a by-product the tile coordinate at the current zoom level.
ExampleThe following example displays coordinates for Chicago, IL: latitude/longitude values, world coordinates, pixel coordinates, and tile coordinates. Use the zoom control to see the coordinate values at various zoom levels.
To see how the coordinates were calculated, view the code.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-02 UTC."],[[["The Maps JavaScript API uses four coordinate systems: latitude/longitude, world, pixel, and tile coordinates."],["World coordinates are derived from latitude/longitude using the Mercator projection and represent a point on the map."],["Pixel coordinates specify a pixel on the map at a given zoom level and are calculated from world coordinates."],["Tile coordinates identify a specific map tile at a particular zoom level, crucial for efficient map loading."],["Each zoom level quadruples the resolution and pixel space compared to the previous level due to the tiling system."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4