Tilt and Rotation

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

You can programmatically adjust tilt and rotation (heading) on a vector map. In this example, we add some buttons to programmatically adjust tilt and heading.

Understand the code

Setting tilt and heading

  • Call setTilt() to set the tilt angle of the map. Use getTilt() to get the current tilt value.
  • Call setHeading() to set the heading of the map. Use getHeading() to get the current heading value.

Try Sample

Clone Sample

Git and Node.js are required to run this sample locally. Follow these instructions to install Node.js and NPM. The following commands clone, install dependencies and start the sample application.

  git clone -b sample-webgl-tilt-rotation https://github.com/googlemaps/js-samples.git
  cd js-samples
  npm i
  npm start

Other samples can be tried by switching to any branch beginning with sample-SAMPLE_NAME.

  git checkout sample-SAMPLE_NAME
  npm i
  npm start