3

I'm trying to display a map just like Google does here https://www.google.fr/maps

With google maps API, I'm struggling at finding the following :

  • makeing ctrl + drag change the tilt
  • programmatically setting the tilt to 0, but keep 3D imagery (for high resolution purpose basically)
  • programmatically setting the tilt to a custom value (say 30 degrees)
  • makeing ctrl + drag rotate the map
  • programmatically rotate the map to a custom value

Is that even possible ?

Cyril CHAPON
  • 3,556
  • 4
  • 22
  • 40
  • In the normal Google Maps website you can tilt any location by holding control down (in the Google Chrome browser at least), even locations without 45 degree imagery. Whereas in Google Maps API you can only tilt/rotate areas that have 45 degree imagery (city centres etc) – Matthew Apr 05 '18 at 02:34

2 Answers2

2

First off, the map in your link by default does not support 45 degree tilt nor rotate options, as that is a roadmap. In order to enable tilt and rotate options in your map, you will need to set your mapTypeId to "Satellite" or "Hybrid" first and set the rotateControl in your Map Object to true; this is an example adapted from Google Maps API:

function initialiseMap() {
  var map = new google.maps.Map(document.getElementById('map'), {
  center: {lat: 41.390205, lng: ‎2.154007},
  zoom: 12,
  mapTypeId: 'satellite',
  rotateControl: true
  });
  map.setTilt(45);

}

As far as I can tell from their documentation:

Google Maps JavaScript API support special 45 degree imagery for certain location

You can set the heading option and tilt option dynamically by calling the respective method on the map object. But I do not think you can override the preset behavior programmatically unless this is something that I have missed from the documentation . This is another link to the 45 degree service for you.

rags2riches-prog
  • 1,663
  • 1
  • 10
  • 22
-4

if you are in 3d mode and using a desktop, you can tilt or rotate by holding SHIFT+CTRL at the same time. doesnt work in roadmap mode though

Levi
  • 1