0

I am trying to do: map.setHeading(180) but this doesn't work and map remains heading to north. Everything else is working - I am using the very basic template of Gmaps from their docs, zoomings, pannings, markers and other things work as excepted, but the heading not. What am I missing in here?

For example, I got the position and heading from the GPS and I move the marker using marker.setPosition(position) which also works as excepted.

geocodezip
  • 158,664
  • 13
  • 220
  • 245
Raz Buchnik
  • 7,753
  • 14
  • 53
  • 96
  • 1
    [`map.setHeading`](https://developers-dot-devsite-v2-prod.appspot.com/maps/documentation/javascript/reference/map#Map.setHeading) only works on aerial imagery: "Sets the compass heading for **aerial imagery** measured in degrees from cardinal direction North." – geocodezip Feb 17 '20 at 17:00
  • Sorry but I don't understand this. I just want to rotate the map in the direction of the driver. How can I achieve this? – Raz Buchnik Feb 17 '20 at 17:15
  • Take a look at [this](https://stackoverflow.com/a/58563200/6950238) answer. – Andrii Omelchenko Feb 17 '20 at 18:18
  • @AndriiOmelchenko OP is asking about the JS API, not Android. – MrUpsidown Feb 17 '20 at 23:52
  • So this simple option is completely not available under the empire of google maps.. I have used mapbox and moved to google since mapbox charge for each tile request, and this thing can reach to large billings. So both of the competitors dont provide the need. – Raz Buchnik Feb 18 '20 at 04:44

3 Answers3

1

Tilt and rotation are now supported programmatically and by user input when using WebGL rendering. Please see https://developers.google.com/maps/documentation/javascript/webgl/tilt-rotation for documentation and examples.

intotecho
  • 4,925
  • 3
  • 39
  • 54
0

Try beta version of JavaScript API. add v=beta in url.

-1

The reason for this is that you can use setHeading if your map is displaying 45 degrees imagery as stated on the documentation.

It looks like your use case is the same as this existing Feature Request which is requesting for a feature to change the orientation of the map. You can star the issue to receive updates regarding the issue. You can also leave a comment on the issue regarding your use case.

Pagemag
  • 2,779
  • 1
  • 7
  • 17