How to center a map


#1

I set a mark on a map
My actual code is:

    point = new google.maps.LatLng(latitud, longitud)
    marker = GoogleMap1.setMarker({icon: elicon,position: point,center: point})

and I would like to know what function centers the map at that point.


#2

Using this as a guide, one of these should work:

 map.setCenter(new google.maps.LatLng(latitud, longitud)); // or
 map.setCenter({ lat: latitud, lng: longitud }); 

Kind regards,
Doug


#3

Thanks Doug but it doesn’t work.
My code is:
point = new google.maps.LatLng(latitud, longitud)
marker = GoogleMap1.setMarker({icon: elicon,position: point,center: point})

So when I call map.setCenter… the object map is not recognized.
But is I type Googlemap1.setCenter… the runtime give an error. It not recognized the comand.

In JavaScript (into a php web program I use map.setCenter and Works propertly.

If you imagine a way for this to work or you saw it work in another code, please let me know.

Thank
Guillermo