编辑这个问题已经得到解答,但我已经为未来的读者澄清过了。
RouteBoxer在Google地图中提供了“装箱”路线的解决方案,以便我可以列出该路线上的各种兴趣点。此技术虽然在地图上显示的每个框周围创建边框。我附上了一张图片来描述它的样子。
为创建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
}
}
});
是否可以删除地图上每个方框周围的边框?
答案 0 :(得分:2)
你完全可以控制。以上是小提琴中的例子,没有黑色边框 - &gt; 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
&#39; s you can style as you are used to。 RouterBoxer-code中没有任何内容强制某些设计或风格。