2

I'm looking for some sample code (in the context of Google Maps) that

  1. periodically checks my server database, to see if there is a new location that differs from the currently known location. I think I've found a solution direction here, so the core of my question is:
  2. in my browser, moves the center of the Google Map from the last know location to the now current location in a smooth, animated way.

I have found a similar dead-end question here, suggesting that this is a fishy kind of question to ask, but I try nevertheless.

Thanks for your input!

Community
  • 1
  • 1
Sjakelien
  • 2,255
  • 3
  • 25
  • 43

1 Answers1

5

You can move the map to a new center just by using this code:

map.setCenter(newCenter:LatLng) OR
map.panTo(newCenter:LatLng)

if the distance between two LatLng objects be small enough, it moves smoothly by itself, otherwise you should wait for map tiles to be loaded for the new center location.

sonya kochooloo
  • 114
  • 1
  • 5