编辑这个问题已得到解答,但我已为 future 的读者进行了澄清。
RouteBoxer提供了在 Google map 中“装箱”路线的解决方案,以便我可以列出该路线沿途的各个兴趣点。不过,这种技术会在 map 上显示的每个框周围创建边框。我附上了一张图片来描述它的样子。
创建 RouteBoxer 的代码如下所示:
<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/routeboxer/src/RouteBoxer.js"></script>
var directionService = new google.maps.DirectionsService();
var rboxer = new RouteBoxer();
var distance = 20; // km
directionService.route(request, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
// Box the overview path of the first route
var path = result.routes[0].overview_path;
var boxes = routeBoxer.box(path, distance);
for (var i = 0; i < boxes.length; i++) {
var bounds = box[i];
// Perform search over this bounds
}
}
});
是否可以删除 map 上每个框周围的边框?
最佳答案
您拥有完全的控制权。这是上面的 fiddle 示例,没有黑色边框 -> http://jsfiddle.net/ftgr8dyp/ 看一下函数drawBoxes()
:
function drawBoxes(boxes) {
boxpolys = new Array(boxes.length);
for (var i = 0; i < boxes.length; i++) {
boxpolys[i] = new google.maps.Rectangle({
bounds: boxes[i],
fillOpacity: 0,
strokeOpacity: 1.0,
strokeColor: '#000000', //<-- change color
strokeWeight: 0, //<-- change strokeWeight from 1 to 0
map: map
});
}
}
这是标准 google.maps.Rectangle
的 you can style as you are used to 。 RouterBoxer-code里什么都没有强制某些设计或风格。
关于javascript - 是否可以删除 RouteBoxer-boxes 的边框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28556325/