tags:

views:

325

answers:

1

I have a map with multiple markers plotted with addMarker/addOverlay. I would like one of these markers to be auto-selected when the map loads, and the map to center around it. How can I do this?

+3  A: 

What do you mean by having the marker be "auto-selected"? Do you mean showing an InfoWindow for it (that's the little bubble with text sticking out of the marker)? If so, call openInfoWindow on the marker and supply the stuff you want to be shown. I believe that will also pan the map so that the marker is shown.

If that doesn't pan the map like I think it should, you can set the center of the map using setCenter on the GMap2 object.

aem
Thank you very much, that solved my problem. I meant openInfoWindow :-).
Johan