如何在JS中围绕路线绘制多边形?

时间:2013-07-22 12:14:39

标签: google-maps

有没有办法在routeService周围画一个多边形?

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 {

    }
  });

我不知道从哪里开始呢?

0 个答案:

没有答案