I have a Google map I created in Javascript using the v3.8 api:
var myOptions = {
center: map_center,
panControl: false,
zoomControl: true,
scaleControl: true,
streetViewControl: false,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.SATELLITE, google.maps.MapTypeId.ROADMAP],
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
}
};
var map = new google.maps.Map(Dom.get('map_canvas'), myOptions);
But I don't want the label in the maptype control to be 'Satellite', I would like to it to say something else. Any way to do this without doing a custom control like this:
.html#CustomControls
Thanks!
Brian
I have a Google map I created in Javascript using the v3.8 api:
var myOptions = {
center: map_center,
panControl: false,
zoomControl: true,
scaleControl: true,
streetViewControl: false,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.SATELLITE, google.maps.MapTypeId.ROADMAP],
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
}
};
var map = new google.maps.Map(Dom.get('map_canvas'), myOptions);
But I don't want the label in the maptype control to be 'Satellite', I would like to it to say something else. Any way to do this without doing a custom control like this:
http://code.google./apis/maps/documentation/javascript/controls.html#CustomControls
Thanks!
Brian
Share Improve this question asked Mar 6, 2012 at 20:52 BrianPBrianP 451 silver badge8 bronze badges2 Answers
Reset to default 6It is [currently] possible to change the label with
map.mapTypes.satellite.name='NewName';
map.setOptions({'mapTypeControl':true});
The labels need to be set once the map has been initialised, so addListenerOnce
on the map's idle
event can be used. Example: http://www.acleach.me.uk/gmaps/v3/map-customlabels.htm
I think , there is no way to change labels of mapTypes with Google Maps API (maybe for localization ). So the way I suggest, to create your own menu of mapTypes. Create menu and use menu item's click to call setMapTypeId method of google maps's object.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745552994a4632663.html
评论列表(0条)