71

I am using google map API version-3 , I was trying with different zoom value, I have randomly done for some numbers started with 1 upto 100 , map gets zoom in for increasing numbers but some level giving same result, I mean I am getting same zoom for 30 and 100.

I like to know , what is the exact range for zoom?

Robin Michael Poothurai
  • 5,444
  • 7
  • 23
  • 36

6 Answers6

82

Google Maps basics

Zoom Level - zoom

0 - 19

0 lowest zoom (whole world)

19 highest zoom (individual buildings, if available) Retrieve current zoom level using mapObject.getZoom()

wallyk
  • 56,922
  • 16
  • 83
  • 148
Himanshu
  • 1,158
  • 2
  • 10
  • 11
  • 1
    Checking https://developers.google.com/maps/documentation/javascript/tutorial#MapOptions, the max zoom level appears to be 18. Has there been a change or is the doc incorrect? The same is stated in the link @bkaid mentioned in his answer. – Jayawi Perera Sep 17 '13 at 04:46
  • 4
    @Jay: value 18 is not max zoom level. It is just used in that example. See google docs [Maximum Zoom Imagery Service](https://developers.google.com/maps/documentation/javascript/maxzoom): _Most roadmap imagery is available from zoom levels 0 to 18, for example. Satellite imagery varies more widely as this imagery is not generated, but directly photographed._ Neither 18 nor 19 is the highest zoom level. So, if you want to know max zoom at specific point you have to use `getMaxZoomAtLatLng()` as @bkaid stated. – Anto Jurković Jan 07 '14 at 08:22
69

Available Zoom Levels

Zoom level 0 is the most zoomed out zoom level available and each integer step in zoom level halves the X and Y extents of the view and doubles the linear resolution.

Google Maps was built on a 256x256 pixel tile system where zoom level 0 was a 256x256 pixel image of the whole earth. A 256x256 tile for zoom level 1 enlarges a 128x128 pixel region from zoom level 0.

As correctly stated by bkaid, the available zoom range depends on where you are looking and the kind of map you are using:

  • Road maps - seem to go up to zoom level 22 everywhere
  • Hybrid and satellite maps - the max available zoom levels depend on location. Here are some examples:
  • Remote regions of Antarctica: 13
  • Gobi Desert: 17
  • Much of the U.S. and Europe: 21
  • "Deep zoom" locations: 22-23 (see bkaid's link)

Note that these values are for the Google Static Maps API which seems to give one more zoom level than the Javascript API. It appears that the extra zoom level available for Static Maps is just an upsampled version of the max-resolution image from the Javascript API.

Map Scale at Various Zoom Levels

Google Maps uses a Mercator projection so the scale varies substantially with latitude. A formula for calculating the correct scale based on latitude is:

meters_per_pixel = 156543.03392 * Math.cos(latLng.lat() * Math.PI / 180) / Math.pow(2, zoom)

Formula is from Chris Broadfoot's comment.

Kev
  • 15,899
  • 15
  • 79
  • 112
JeremyD
  • 706
  • 6
  • 3
  • `Google Static Maps API`? Whoa. Many thanks for mentioning that! Link to [API here...](https://developers.google.com/maps/documentation/static-maps/) – zipzit Jun 07 '16 at 00:56
  • When mapping of entire earth into 256x256 tile, which projection is used? – Dims Mar 30 '17 at 11:49
  • Thanks for the API link, @zipzit! I added the link inline. – JeremyD Aug 17 '17 at 02:48
  • 1
    @Dims – all zoom levels for Google Static Maps use the Mercator projection. WhiteRabbit's comment on [this thread](https://productforums.google.com/forum/#!topic/maps/A2ygEJ5eG-o) explains why the Mercator projection was used, even though it exaggerates the scale of land farther from the equator. Anders Kaseorg's response to [this Quora question](https://www.quora.com/Why-does-Google-Maps-keep-using-a-Mercator-projection-rather-than-switching-to-another-projection-that-represents-the-earth-more-accurately) provides an even more detailed explanation. – JeremyD Aug 17 '17 at 02:57
32

What you're looking for are the scales for each zoom level. Use these:

20 : 1128.497220
19 : 2256.994440
18 : 4513.988880
17 : 9027.977761
16 : 18055.955520
15 : 36111.911040
14 : 72223.822090
13 : 144447.644200
12 : 288895.288400
11 : 577790.576700
10 : 1155581.153000
9  : 2311162.307000
8  : 4622324.614000
7  : 9244649.227000
6  : 18489298.450000
5  : 36978596.910000
4  : 73957193.820000
3  : 147914387.600000
2  : 295828775.300000
1  : 591657550.500000
Sam R.
  • 16,027
  • 12
  • 69
  • 122
Rahul Shinde
  • 1,522
  • 1
  • 15
  • 17
12

The range depends on where you are looking at. Some places only have zoom levels of 15 or so, where as other places have 23 (or possibly more). Google Maps has a getMaxZoomAtLatLng API call you can make to retrieve the max zoom level.

Community
  • 1
  • 1
bkaid
  • 51,465
  • 22
  • 112
  • 128
3

Use this function in order to get the best zoom based on your current location and a distance to the point (C# code tested with GMap.net on VS2022 but zoom levels and algorithm are the same for Google):

/// <summary>
/// Zoom map to fit the desired distance from point
/// </summary>
/// <param name="mapSize">The size of the control (map size in pixels)</param>
/// <param name="coverage">Ratio of the map, normally 70 (70%)</param>
/// <param name="latitude">Latitude where the point to draw is located</param>
/// <param name="distance">Distance to show from this point in meters</param>
/// <param name="minZoomLevel">Min level of zoom (normally 18)</param>
/// <param name="maxZoomLevel">Max level of zoom (normally 1)</param>
/// <returns>Zoom level</returns>
static double CalculateGMapZoom(Size mapSize, int coverage, double latitude, double distance, int minZoomLevel, int maxZoomLevel)
{
    int pixels = mapSize.Width >= mapSize.Height ? mapSize.Height : mapSize.Width; //get the shortest dimmension of the map   
    double k = (double)pixels * 156543.03392 * Math.Cos(latitude * Math.PI / 180); 
    int zoom = (int)((Math.Round(Math.Log((coverage * k) / (distance * 100)) / 0.6931471805599453)) - 1);
    return (zoom > maxZoomLevel ? (double)maxZoomLevel: (zoom < minZoomLevel ? (double)minZoomLevel: (double)zoom));
}

Usage:

map.Zoom = CalculateGMapZoom(mapa.Size, 70, latitude, 1000, 1, 18);
   
0

To add to the discussion: if you have a desired size of map in meters, and you want to find the zoom level, you can use this equation using numpy to find it:

where "map_edge_length" is your input

zoom_req_float = np.log2((156543.03392 * np.cos(center_lat * np.pi / 180)) / (map_edge_length / 256))
zoom_req = int(np.ceil(zoom_req_float))