admin管理员组文章数量:1431398
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.
本文标签: javascriptChanging Google maps 39Satellite label to something else in v38Stack Overflow
版权声明:本文标题:javascript - Changing Google maps 'Satellite label to something else in v3.8? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745552994a2663029.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论