谷歌地图折线与阴影

Mau*_*ähä 2 google-maps google-maps-api-3

我最近发现了一个使用fusiontablelayer在地图上显示路线的例子,我想知道如何设计我的普通折线以产生这样的阴影:http://gmaps-samples-v3.googlecode.com/svn/trunk/fusiontables/ cycletrails.html那些看起来非常非常好,我无法找到解决方案来完成我的折线.(没有阴影的折线示例:https://google-developers.appspot.com/maps/documentation/javascript/examples/polyline-simple)

Thnx提前!

geo*_*zip 5

你可以这样做:

http://www.geocodezip.com/v3_GoogleEx_polyline-simple_shadow.html

(在你的下面放一条较厚的透明折线,看起来就像我看到的那样)

您可以通过使用KmlLayer或FusionTablesLayer而不是本机Google Maps API v3 Polylines以相同的方式获得相同的效果.

码:

function initialize() {
  var myLatLng = new google.maps.LatLng(0, -180);
  var mapOptions = {
    zoom: 3,
    center: myLatLng,
    mapTypeId: google.maps.MapTypeId.TERRAIN
  };

  var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);

  var flightPlanCoordinates = [
      new google.maps.LatLng(37.772323, -122.214897),
      new google.maps.LatLng(21.291982, -157.821856),
      new google.maps.LatLng(-18.142599, 178.431),
      new google.maps.LatLng(-27.46758, 153.027892)
  ];
  var flightPathShadow = new google.maps.Polyline({
    path: flightPlanCoordinates,
    strokeColor: 'black',
    strokeOpacity: 0.1,
    strokeWeight: 10
  });

  flightPathShadow.setMap(map);

  var flightPath = new google.maps.Polyline({
    path: flightPlanCoordinates,
    strokeColor: '#FF0000',
    strokeOpacity: 1.0,
    strokeWeight: 2
  });

  flightPath.setMap(map);
}
Run Code Online (Sandbox Code Playgroud)