Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/403.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 谷歌地图:阴影城市_Javascript_Google Maps_Maps_Google Visualization - Fatal编程技术网

Javascript 谷歌地图:阴影城市

Javascript 谷歌地图:阴影城市,javascript,google-maps,maps,google-visualization,Javascript,Google Maps,Maps,Google Visualization,我搜索了很多,但在谷歌地图上找不到如何给城市区域加上阴影。这可以通过谷歌图表实现,但它不是交互式的。我希望它完全像谷歌地图,但有边界。 例如,在谷歌地图上搜索达拉斯,看它画边界。我想在我的网站上显示完全一样的内容。我想在同一张地图中显示多个城市边界。谷歌地图API不提供此功能。因此,如果要高亮显示区域,则必须基于州边界的纵横比创建自定义覆盖 一旦你有了纵横边界,你必须自己画多边形 例如: // Define the LatLng coordinates for the polygon's pat

我搜索了很多,但在谷歌地图上找不到如何给城市区域加上阴影。这可以通过谷歌图表实现,但它不是交互式的。我希望它完全像谷歌地图,但有边界。
例如,在谷歌地图上搜索达拉斯,看它画边界。我想在我的网站上显示完全一样的内容。我想在同一张地图中显示多个城市边界。

谷歌地图API不提供此功能。因此,如果要高亮显示区域,则必须基于州边界的纵横比创建自定义覆盖

一旦你有了纵横边界,你必须自己画多边形

例如:

// Define the LatLng coordinates for the polygon's path.
    var washingtonShapeCoords = [new google.maps.LatLng(38.8921, -76.9112),
                           new google.maps.LatLng(38.7991, -77.0320),
                           new google.maps.LatLng(38.9402, -77.1144),
                           new google.maps.LatLng(38.9968, -77.0430),
                           new google.maps.LatLng(38.8996, -76.9167),
                           new google.maps.LatLng(33.7243, -74.8843),
                           new google.maps.LatLng(33.7243, -72.6870),
                           new google.maps.LatLng(32.3243, -72.6870),
                           new google.maps.LatLng(32.3985, -76.7300),
                           new google.maps.LatLng(33.7152, -76.6957),
                           new google.maps.LatLng(33.7243, -74.9489),
                           new google.maps.LatLng(38.8921, -76.9112)];

// Construct the polygon.
  washingtonPolygon = new google.maps.Polygon({
    paths: washingtonShapeCoords,
    strokeColor: '#FF0000',
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: '#FF0000',
    fillOpacity: 0.35
  });

  washingtonPolygon.setMap(map);