1

I am using a Google Map on the background of a site, there are 2 layers over the map, a filter on the left (with 200px) and some content on the right (with 500px). These are transparent layers so I have to use the map as a background. Now the center of the map is not the real center of it.

Is there a way that I can overrule the center of the map and set the center to a specific point in the map??

Peter Hut
  • 33
  • 4
  • 1
    Yes, `map.setCenter()` – davidkonrad Jan 24 '14 at 12:37
  • Thanks, with this function you can set a location as the center of the map, but I want the center of the map not in the center. So I want to correct the center for instance 200 pix to the left. – Peter Hut Jan 24 '14 at 13:01
  • Yes, so what about setting that location a little bit to the left? `map.setCenter()` takes a `LatLng` object, not pixels. – MrUpsidown Jan 24 '14 at 13:04
  • do you have an idea how to do this? with a fixed amount of pixels? – Peter Hut Jan 24 '14 at 13:12
  • 1
    OK, now I see your point :) see this-> http://stackoverflow.com/questions/10656743/how-to-offset-the-center-point-in-google-maps-api-v3 to move center relatively in pixels (see the link in the answer and its source, think it is exactly what you need - when clicking the buttom it moves down 100px and left 200px, you just need to move left – davidkonrad Jan 24 '14 at 13:35
  • thanks, this is helpfull, this also worked: map.panBy(150, -50); – Peter Hut Jan 24 '14 at 14:58
  • How did I forget about the panBy() method? :-) – MrUpsidown Jan 24 '14 at 15:36

0 Answers0