gpt4 book ai didi

javascript - 默认Gmap3样式

转载 作者:行者123 更新时间:2023-12-03 08:22:27 24 4
gpt4 key购买 nike

嗨,我使用 gmap3(jquery 插件)来显示谷歌地图。这是页面链接:website这是js代码:

                $("#mapa").gmap3({
defaults:{
classes:{
Marker:MarkerWithLabel
}
},
map:{
options:{
zoom: 16,
center: new google.maps.LatLng(54.81592345170086,17.954444355125368),
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP, "style1"]
},
icon: new google.maps.MarkerImage("assets/gfx/itmarker_01.png", new google.maps.Size(64, 60, "px", "px")),
streetViewControl: false,
draggable: true,
}
}
,
styledmaptype:{
id: "style1",
options:{
name: "Style 1"
},
styles: [
{
featureType: "landscape",
stylers: [
{ hue: "#013e53" },
{ saturation: 0 },
{ lightness: 0 }
]
}
]
}
,
marker:{
latLng:[54.81558744636294,17.954398119049074],
options:{
icon: new google.maps.MarkerImage("assets/gfx/itmarker_01.png", new google.maps.Size(64, 60, "px", "px")),
labelContent: "$425K",
labelAnchor: new google.maps.Point(160, 110),
labelClass: "labels",
labelStyle: {opacity: 0.9},
labelContent: "PROMYK<br/>ul. Lubiatowska 4/3, 84-113 Białogóra",
}
}

});
function toggleStreetView(){
var promyk = {lat: 54.81557641505586, lng: 17.954616016502314};
var map = $("#mapa").gmap3("get"),
panorama = map.getStreetView();
if (panorama.getVisible()){
panorama.setVisible(false);
} else {
//panorama.setPosition(map.getCenter());
panorama.setPosition(promyk);
panorama.setPov({
heading: 320,
zoom:1,
pitch:5
});
panorama.setVisible(true);
}
}

它工作正常。我正在寻找某种方法将我的“样式 1”设置为该 map 的默认样式,而无需控件来更改卫星或路线图。我的风格仅改变具有色调效果的颜色。

最佳答案

找到了

                    $("#mapa").gmap3({
defaults:{
classes:{
Marker:MarkerWithLabel
}
},
map:{
options:{
zoom: 16,
center: new google.maps.LatLng(54.81592345170086,17.954444355125368),
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP, "style1"]
},
styles: [
{
featureType: "landscape",
stylers: [
{ hue: "#013e53" },
{ saturation: 0 },
{ lightness: 0 }
]
}
],
icon: new google.maps.MarkerImage("assets/gfx/itmarker_01.png", new google.maps.Size(64, 60, "px", "px")),
streetViewControl: false,
draggable: true,
}
}
,
marker:{
latLng:[54.81558744636294,17.954398119049074],
options:{
icon: new google.maps.MarkerImage("assets/gfx/itmarker_01.png", new google.maps.Size(64, 60, "px", "px")),
labelContent: "$425K",
labelAnchor: new google.maps.Point(160, 110),
labelClass: "labels",
labelStyle: {opacity: 0.9},
labelContent: "PROMYK<br/>ul. Lubiatowska 4/3, 84-113 Białogóra",
}
}

});
function toggleStreetView(){
var promyk = {lat: 54.81557641505586, lng: 17.954616016502314};
var map = $("#mapa").gmap3("get"),
panorama = map.getStreetView();
if (panorama.getVisible()){
panorama.setVisible(false);
} else {
//panorama.setPosition(map.getCenter());
panorama.setPosition(promyk);
panorama.setPov({
heading: 320,
zoom:1,
pitch:5
});
panorama.setVisible(true);
}
}

关于javascript - 默认Gmap3样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33694042/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com