【发布时间】:2018-03-21 11:17:04
【问题描述】:
我想删除所有的空格和圆角,这样地图看起来就像是一张完整的地图,没有任何分块,也许我可以修改某种地图图块属性以使其看起来像正常的地图,下面是我的代码
function initMap() {
var pointA = new google.maps.LatLng(51.7519, -1.2578),
pointB = new google.maps.LatLng(50.8429, -0.1313),
myOptions = {
zoom: 7,
center: pointA
},
map = new google.maps.Map(document.getElementById('map-canvas'), myOptions),
// Instantiate a directions service.
directionsService = new google.maps.DirectionsService,
directionsDisplay = new google.maps.DirectionsRenderer({
map: map
}),
markerA = new google.maps.Marker({
position: pointA,
title: "point A",
label: "A",
map: map
}),
markerB = new google.maps.Marker({
position: pointB,
title: "point B",
label: "B",
map: map
});
google.maps.event.trigger(map, 'resize');
// get route from A to B
calculateAndDisplayRoute(directionsService, directionsDisplay, pointA, pointB);
}
function calculateAndDisplayRoute(directionsService, directionsDisplay, pointA, pointB) {
directionsService.route({
origin: pointA,
destination: pointB,
travelMode: google.maps.TravelMode.DRIVING
}, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
} else {
swal("не удалось загрузить карту");
}
});
}
initMap();
【问题讨论】:
-
那是一个。 CSS 问题(您的 CSS 不应该被应用于地图
<img>瓷砖)。您没有发布任何 CSS。请提供一个 minimal reproducible example 来证明您的问题。 -
这就是我正在寻找的答案谢谢)))
标签: javascript css google-maps matrix google-api