我最近发现了一个使用 fusiontablelayer 在 map 上显示路线的示例,我想知道如何设计我的正常多段线以具有如下阴影:http://gmaps-samples-v3.googlecode.com/svn/trunk/fusiontables/cycletrails.html这些看起来真的非常好,但我找不到用我的折线来做到这一点的解决方案。 (没有阴影的折线示例:https://google-developers.appspot.com/maps/documentation/javascript/examples/polyline-simple)
提前致谢!
最佳答案
你可以这样做:
http://www.geocodezip.com/v3_GoogleEx_polyline-simple_shadow.html
(在你的下面放一条更粗的透明折线,看起来就像我看到他们在做什么)
通过使用 KmlLayer 或 FusionTablesLayer(而不是原生 Google Maps API v3 折线),您可能可以以相同的方式获得相同的效果。
代码:
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);
}
关于google-maps - 谷歌地图带阴影的折线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12616011/