3

I want to set the center of a map with Javascript.

I can only find some code with Markers in it, but I want the client side code for this:

/* Server code */
GMap1.setCenter(latlng, zoomLevel, mapType  );

I would like to do this (it's non working code :-))

<script>
    subgurim_GMap1.SetCenter(47.1, 2.3, 6)
</script>

Where 47.1 and 2.3 are the Lat/Lng and 6 is the Zoom level.

Marc Climent
  • 9,434
  • 2
  • 50
  • 55
Michel
  • 23,085
  • 46
  • 152
  • 242

1 Answers1

3

Try this:

map.setZoom(6);
var point = new GLatLng(26.228595038041917, 50.54535984992981);
map.setCenter(point);
karim79
  • 339,989
  • 67
  • 413
  • 406