Top-down view

This sample demonstrates how to initialize the map, zoomed in, looking directly down at the surface at a 90-degree angle (also known as a nadir view).

CSS

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
}

gmp-map-3d {
    height: 100%;
    width: 100%;
}

HTML

<html>
    <head>
        <title>3d-map-nadir-view</title>

        <link rel="stylesheet" type="text/css" href="./style.css" />
        <script
            async
            src="https://maps.googleapis.com/maps/api/js?loading=async&key=GOOGLE_MAPS_API_KEY&libraries=maps3d"></script>
    </head>
    <body>
        <gmp-map-3d
            center="37.803,-122.448,0"
            range="2500"
            tilt="0"
            heading="0"
            mode="roadmap">
        </gmp-map-3d>
    </body>
</html>

Try Sample

Clone Sample

Before running this sample locally, make sure you have:

The following commands clone the repository, install dependencies, and copy the environment file.

  git clone https://github.com/googlemaps-samples/js-api-samples.git
  cd js-api-samples
  npm i
  cp .env.template .env

Once you copy the environment file, make sure to open the .env file and replace <Insert your own development API key here> with your actual API key before starting the sample.

In the sample code, GOOGLE_MAPS_API_KEY is a placeholder. When you run the sample, the API key from your .env file replaces it. In your own app, read the key only from an environment variable, with no literal key as a fallback value in source code.

  cd samples/3d-map-nadir-view
  npm start