谷歌地图使用多个圆形图块呈现

时间:2018-03-21 11:17:04

标签: javascript css google-maps matrix google-api

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();

1 个答案:

答案 0 :(得分:0)

地图的瓷砖受到img造型的影响,我改变了我的css以绕过地图样式并解决了我的问题