【问题标题】:google map is rendered with multiple rounded tiles谷歌地图是用多个圆形瓷砖呈现的
【发布时间】:2018-03-21 11:17:04
【问题描述】:

map is devided into 3x3 tiles

我想删除所有的空格和圆角,这样地图看起来就像是一张完整的地图,没有任何分块,也许我可以修改某种地图图块属性以使其看起来像正常的地图,下面是我的代码

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


【解决方案1】:

地图的图块受 img 样式的影响,我更改了我的 css 以绕过地图样式,它解决了我的问题

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-27
    • 2012-06-30
    • 2012-07-12
    • 2011-02-08
    • 1970-01-01
    相关资源
    最近更新 更多