title: Google Streetview API Indoor panorama.setPosition() redirects to start position
body: <p>I am working on a Google Streetview indoor application using the Google Maps JS API. I am using panorama pictures that are available on Google Streetview. I sometimes want to programatically change the position, for instance when somebody clicks on a position in a small map. However, when I call panorama.getPosition() I automatically get redirected to a different position. I can actually see the position_changed event being triggered twice.</p>
  
  <p>I already sort of found the cause of this issue. It has something to do with the starting/entrance positions Google maps uses for Streetview Indoor. </p>
  
  <p><a href="https://i.stack.imgur.com/GWT4P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GWT4P.png" alt="Google Maps screenshot"></a></p>
  
  <p>The two orange circles depict the two possible starting/entrance points into the building. When dropping the pegman over these circles you will enter the building in Streetview Indoor.</p>
  
  <p>It looks like when these starting points exist, the Google Maps API does not let you programatically set the position to some position other then any of the starting points. It will always redirect you to one of the starting points. This is obviously not what I want.</p>
  
  <pre><code>//The starting/entrance position is lat: 52.089988, lng: 5.178041
  //The position I want to go to 
  var goToPosition = {lat: 52.0898852, lng: 5.1780344};
  
  //Position changed EventListener
  google.maps.event.addListener(panorama, 'position_changed', function() {
      var newPosition = panorama.getPosition();
      console.log('changed position to:', newPosition.lat(), newPosition.lng());
  });
  
  //Calling setPosition with goToPosition
  panorama.setPosition(goToPosition);
  
  //Will result in two console.logs directly printed after another:
  changed position to: 52.0898852 5.1780344 //goToPosition
  changed position to: 52.089988 5.178041 //starting position
  </code></pre>
  
  <p>The console.logs show that it looks like the position is being changed twice directly after each other, ending the position at the starting position.</p>
  
  <p>I'm wondering if any body else has encountered this problem and if there is a known workaround for this. I am in contact with the photographer that uploaded the panorama pictures to Google. Maybe there's something in the way these pictures are uploaded to Google and configured. I wonder if this can even be fixed in my application code, or if it's an API problem or even expected behavior.</p>
  
  <p>Thanks!</p>