A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/maps/documentation/javascript/maxzoom below:

Maximum Zoom Imagery Service | Maps JavaScript API

Maximum Zoom Imagery Service

Stay organized with collections Save and categorize content based on your preferences.

  1. Maximum Zoom Imagery
  2. MaxZoom Requests
  3. MaxZoom Responses
Overview Also see the Maps JavaScript API Reference: Max Zoom

The Google Maps API provides map tiles at various zoom levels for map type imagery. 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.

Because satellite imagery is not always available at high zoom levels for remote locations — sparsely populated areas or open ocean areas — you may want to know the highest zoom level for imagery at a given location beforehand. The MaxZoomService object provides a simple interface for discovering the maximum zoom level at a given location for which Google Maps has satellite imagery.

MaxZoom Requests

Accessing the MaxZoomService is asynchronous, since the Google Maps API needs to make a call to an external server. For that reason, you need to pass a callback method to execute upon completion of the request. This callback method should process the result.

To initiate a request to the MaxZoomService, call getMaxZoomAtLatLng(), passing the LatLng of the location and a callback function to execute upon completion of the request.

MaxZoom Responses

When getMaxZoomAtLatLng() executes the callback function, it will pass back two parameters:

The status code may return one of the following values:

The following example shows a map of metropolitan Tokyo. Clicking anywhere on the map indicates the maximum zoom level at that location. (Zoom levels around Tokyo generally vary between zoom levels 18 and 21.)

TypeScript
let map: google.maps.Map;
let maxZoomService: google.maps.MaxZoomService;
let infoWindow: google.maps.InfoWindow;

function initMap(): void {
  map = new google.maps.Map(document.getElementById("map") as HTMLElement, {
    zoom: 11,
    center: { lat: 35.6894, lng: 139.692 },
    mapTypeId: "hybrid",
  });

  infoWindow = new google.maps.InfoWindow();

  maxZoomService = new google.maps.MaxZoomService();

  map.addListener("click", showMaxZoom);
}

function showMaxZoom(e: google.maps.MapMouseEvent) {
  maxZoomService.getMaxZoomAtLatLng(
    e.latLng as google.maps.LatLng,
    (result: google.maps.MaxZoomResult) => {
      if (result.status !== "OK") {
        infoWindow.setContent("Error in MaxZoomService");
      } else {
        infoWindow.setContent(
          "The maximum zoom at this location is: " + result.zoom
        );
      }

      infoWindow.setPosition(e.latLng);
      infoWindow.open(map);
    }
  );
}

declare global {
  interface Window {
    initMap: () => void;
  }
}
window.initMap = initMap;
Note: Read the guide on using TypeScript and Google Maps. JavaScript
let map;
let maxZoomService;
let infoWindow;

function initMap() {
  map = new google.maps.Map(document.getElementById("map"), {
    zoom: 11,
    center: { lat: 35.6894, lng: 139.692 },
    mapTypeId: "hybrid",
  });
  infoWindow = new google.maps.InfoWindow();
  maxZoomService = new google.maps.MaxZoomService();
  map.addListener("click", showMaxZoom);
}

function showMaxZoom(e) {
  maxZoomService.getMaxZoomAtLatLng(e.latLng, (result) => {
    if (result.status !== "OK") {
      infoWindow.setContent("Error in MaxZoomService");
    } else {
      infoWindow.setContent(
        "The maximum zoom at this location is: " + result.zoom,
      );
    }

    infoWindow.setPosition(e.latLng);
    infoWindow.open(map);
  });
}

window.initMap = initMap;
Note: The JavaScript is compiled from the TypeScript snippet. View example Try Sample

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-09 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-09 UTC."],[[["The Google Maps `MaxZoomService` helps determine the highest zoom level available for satellite imagery at a specific location."],["`MaxZoomService` requests are asynchronous and require a callback function to handle the response, which includes a status and zoom level."],["The response status can be `OK` indicating success or `ERROR` if the request failed."],["A provided example demonstrates using the `MaxZoomService` to display the maximum zoom level when clicking on a map of Tokyo."]]],["The `MaxZoomService` determines the highest zoom level for satellite imagery at a given location. It uses `getMaxZoomAtLatLng()` with a location's `LatLng` and a callback function. The callback returns a `status` (`OK` or `ERROR`) and the `zoom` level. Clicking on a map in the provided example triggers `getMaxZoomAtLatLng()`, which updates an info window with the maximum zoom level or an error message. Access to this service is asynchronous and requires a callback to process results.\n"]]


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