3

有没有办法在路线周围绘制一个多边形,这是 directionService 的结果?

var request = {
    origin: document.getElementById("from").value,
    destination: document.getElementById("to").value,
    travelMode: google.maps.DirectionsTravelMode.DRIVING
  }

  // Make the directions request
  directionService.route(request, function(result, status) {
    if (status == google.maps.DirectionsStatus.OK) {
      directionsRenderer.setDirections(result);          

      var path = result.routes[0].overview_path;
      //Want to draw a polygon here.
    } else {

    }
  });

我不知道从哪里开始?

4

0 回答 0