54 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			HTML
		
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			HTML
		
	
	
<!DOCTYPE html>
 | 
						|
<html>
 | 
						|
<head>
 | 
						|
  <meta charset="utf-8">
 | 
						|
  <title>GMaps.js — Polylines</title>
 | 
						|
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
 | 
						|
  <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
 | 
						|
  <script type="text/javascript" src="../gmaps.js"></script>
 | 
						|
  <link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css" />
 | 
						|
  <link rel="stylesheet" type="text/css" href="examples.css" />
 | 
						|
  <script type="text/javascript">
 | 
						|
    var map;
 | 
						|
    $(document).ready(function(){
 | 
						|
      map = new GMaps({
 | 
						|
        el: '#map',
 | 
						|
        lat: -12.043333,
 | 
						|
        lng: -77.028333,
 | 
						|
        click: function(e){
 | 
						|
          console.log(e);
 | 
						|
        }
 | 
						|
      });
 | 
						|
 | 
						|
      path = [[-12.044012922866312, -77.02470665341184], [-12.05449279282314, -77.03024273281858], [-12.055122327623378, -77.03039293652341], [-12.075917129727586, -77.02764635449216], [-12.07635776902266, -77.02792530422971], [-12.076819390363665, -77.02893381481931], [-12.088527520066453, -77.0241058385925], [-12.090814532191756, -77.02271108990476]];
 | 
						|
 | 
						|
      map.drawPolyline({
 | 
						|
        path: path,
 | 
						|
        strokeColor: '#131540',
 | 
						|
        strokeOpacity: 0.6,
 | 
						|
        strokeWeight: 6
 | 
						|
      });
 | 
						|
    });
 | 
						|
  </script>
 | 
						|
</head>
 | 
						|
<body>
 | 
						|
  <h1>GMaps.js — Polylines</h1>
 | 
						|
  <div class="row">
 | 
						|
    <div class="span11">
 | 
						|
      <div id="map"></div>
 | 
						|
    </div>
 | 
						|
    <div class="span6">
 | 
						|
      <p>You can add polylines in GMaps.js this way:</p>
 | 
						|
      <pre>path = [[-12.044012922866312, -77.02470665341184], [-12.05449279282314, -77.03024273281858], [-12.055122327623378, -77.03039293652341], [-12.075917129727586, -77.02764635449216], [-12.07635776902266, -77.02792530422971], [-12.076819390363665, -77.02893381481931], [-12.088527520066453, -77.0241058385925], [-12.090814532191756, -77.02271108990476]];
 | 
						|
 | 
						|
map.drawPolyline({
 | 
						|
  path: path,
 | 
						|
  strokeColor: '#131540',
 | 
						|
  strokeOpacity: 0.6,
 | 
						|
  strokeWeight: 6
 | 
						|
});</pre>
 | 
						|
      <p>The path of the polyline is defined by an array of array of two (latitude and longitude).</p>
 | 
						|
    </div>
 | 
						|
  </div>
 | 
						|
</body>
 | 
						|
</html> |