2011-09-19 6 views

답변

4

도움이 될 수 있습니다 파이썬 장고를

희망의 사람을 사용하여 I'am. 그러나 경로를 따라 모든 점에 대해 위도와 경도가있는 데이터 집합을 얻을 수 있다면이 코드는 경로를 만듭니다.

<!DOCTYPE html> 
<html> 
<head> 
<title>Draw a polyline given many coordinates</title> 

<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> 
<style type="text/css"> 
html { height: 100% } 
body { height: 100%; margin: 0; padding: 0 } 
#map_canvas { height: 100% } 
</style> 
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js"></script> 

<script> 
    function initialize() { 
     var homeLatlng = new google.maps.LatLng(51.476706,0); 
     var myOptions = { 
      zoom: 15, 
      center: homeLatlng, 
      mapTypeId: google.maps.MapTypeId.ROADMAP 
     }; 
     var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); 

     // create an array of coordinates 
     var arrCoords = [ 
      new google.maps.LatLng(51.482238,0.001581), 
      new google.maps.LatLng(51.473364,0.011966), 
      new google.maps.LatLng(51.471974,-0.000651), 
      new google.maps.LatLng(51.472108,-0.002196), 
      new google.maps.LatLng(51.474995,-0.003827), 
      new google.maps.LatLng(51.476492,-0.005629), 
      new google.maps.LatLng(51.477855,-0.006058), 
      new google.maps.LatLng(51.478443,-0.007045), 
      new google.maps.LatLng(51.479298,-0.007861), 
      new google.maps.LatLng(51.481202,-0.002136), 
      new google.maps.LatLng(51.481577,-0.0022) 
     ]; 

     // draw the route on the map    
     var route = new google.maps.Polyline({ 
      path: arrCoords, 
      strokeColor: "#00FF00", 
      strokeOpacity: 1.0, 
      strokeWeight: 4, 
      geodesic: false, 
      map: map 
     }); 
    } 

    google.maps.event.addDomListener(window, 'load', initialize); 
</script> 
</head> 
<body> 
    <div id="map_canvas"></div> 
</body> 
</html> 
+0

대단히 감사합니다. D 이것은 내가 찾고있는 것입니다. – Arcadia

관련 문제