Google Maps API未显示道路

时间:2016-08-12 19:00:54

标签: javascript google-maps

我的网站没有在Google地图中显示道路(我使用的是Google地图API)。 地图的样式有点与网站主题相匹配。道路可见一段时间了。但它现在已经消失了

以下是使用的样式代码;

var myCenter=new google.maps.LatLng(40.760845,-73.98611);
var marker;

function initialize()
{
var mapProp = {
  center:myCenter,
  zoom:16,
  mapTypeId:google.maps.MapTypeId.ROADMAP
  };

var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);

var marker=new google.maps.Marker({
  position:myCenter,
  animation:google.maps.Animation.DROP,
icon: 'http://www.dummywebsite.com/dummyimages/icon.png'
  });

var styles = [
  {
    featureType: "administrative.locatlity",
    elementType: "geometry.fill",
    stylers: [
      { "color": "#444444" },
      { weight: "1.8" }
    ]
  },{
    featureType: "road",
    elementType: "geometry.fill",
elementType: "geometry.stroke",
    stylers: [
      { visibility: "on" },
{"color":"#000000"},
{ "lightness": 45}

    ]
  },


{
        "featureType": "all",
        "elementType": "labels.text.stroke",
        "stylers": [
            {
                "visibility": "off"
            },
            {
                "color": "#000000"
            },
            {
                "lightness": 12
            }
        ]
    },


    {
        "featureType": "business",
        "elementType": "geometry.stroke",
        "stylers": [
            {
                "color": "#555555"
            },
            {
                "lightness": 20
            }
        ]
    },


{
        "featureType": "all",
        "elementType": "labels.text.fill",
        "stylers": [
            {
                "visibility": "on"
            },
            {
                "color": "#888888"
            },
            {
                "lightness": 25
            }
        ]
    },

];



map.setOptions({styles: styles});



marker.setMap(map);
}

google.maps.event.addDomListener(window, 'load', initialize);

寻求宝贵的支持来解决这个问题。

以下是它现在的样子。道路不见了

enter image description here

1 个答案:

答案 0 :(得分:0)

你是否也看到了怪异的矢量?也许这个链接会有所帮助:https://productforums.google.com/forum/#!topic/maps/DwlA6_TFDZg

如果没有尝试谷歌搜索"谷歌地图道路出现然后逐渐消失"