Javascript地圖庫:Leaflet
Leaflet是一個開源的地圖Javascript庫,它由Universal Mind的Vladimir Agafonkin創建的。我們將在一個應用程序中使用這個封裝組件。該應用程序給我們展示了一個地圖并提供了一個可以移動到地圖中指定位置的按鈕。
示例代碼:
// create a map in the "map" div, set the view to a given place and zoom var map = L.map('map').setView([51.505, -0.09], 13); // add an OpenStreetMap tile layer L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '© <a >OpenStreetMap</a> contributors' }).addTo(map); // add a marker in the given location, attach some popup content to it and open the popup L.marker([51.5, -0.09]).addTo(map) .bindPopup('A pretty CSS3 popup. <br> Easily customizable.') .openPopup();
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!