2014-09-25 53 views
0

我更新了傳單提升示例gpx,只是更改了gox名稱,在win 7或OS X以及Safari或Chrome上本地工作。什麼都沒有出現。 leafletjs.elevation不會顯示gpx

\t \t var map = new L.Map('map'); 
 

 
\t \t var url = 'http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg', 
 
\t \t \t attr ='Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> &mdash; Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>', 
 
\t \t \t service = new L.TileLayer(url, {subdomains:"1234",attribution: attr}); 
 

 
\t \t var el = L.control.elevation(); 
 
\t \t el.addTo(map); 
 
\t \t var g=new L.GPX("./maggiore.gpx", { 
 
\t \t \t async: true, 
 
\t \t \t marker_options: { 
 
\t \t \t  startIconUrl: './lib/leaflet-gpx/pin-icon-start.png', 
 
\t \t \t  endIconUrl: './lib/leaflet-gpx/pin-icon-end.png', 
 
\t \t \t  shadowUrl: './lib/leaflet-gpx/pin-shadow.png' 
 
\t \t \t } 
 
\t \t }); 
 
\t \t g.on('loaded', function(e) { 
 
\t \t \t \t map.fitBounds(e.target.getBounds()); 
 
\t \t }); 
 
\t \t g.on("addline",function(e){ 
 
\t \t \t el.addData(e.line); 
 
\t \t }); 
 
\t \t g.addTo(map); 
 
\t \t map.addLayer(service);
<link href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" rel="stylesheet"/> 
 
<head> 
 
\t <title>Leaflet.Elevation</title> 
 
\t <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> 
 
\t <style> 
 
\t html, body, #map { 
 
\t  height:100%; 
 
\t  width:100%; 
 
\t  padding:0px; 
 
\t  margin:0px; 
 
\t } 
 
\t </style> 
 
\t <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> 
 
\t <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" /> 
 
\t <!--[if lte IE 8]><link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.ie.css" /><![endif]--> 
 

 
\t <link rel="stylesheet" href="../dist/Leaflet.Elevation-0.0.2.css" /> 
 

 
\t <script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script> 
 
\t <script type="text/javascript" src="../dist/Leaflet.Elevation-0.0.2.min.js"></script 
 
\t ><script type="text/javascript" src="./lib/leaflet-gpx/gpx.js"></script> 
 
</head> 
 
<body> 
 

 
\t <div id="map"></div>

我得到的變焦控制和一個空的圖

回答

0

你有沒有leaftlet.elevation DIST文件灰色頁面? 看着你的榜樣,你有:

<link rel="stylesheet" href="../dist/Leaflet.Elevation-0.0.2.css" /> 
<script type="text/javascript" src="../dist/Leaflet.Elevation-0.0.2.min.js"></script 

你可以將這些文件複製到lib文件夾。

+0

是的,我得到了所有的文件 – 2014-09-27 21:34:21