Created
May 15, 2020 15:25
-
-
Save mohas/71232c38e7d7263a169da37f286d1963 to your computer and use it in GitHub Desktop.
quick leaflet Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="row"> | |
<div id="to_hell_with_g_map" style="width: 100%; height: 500px"></div> | |
</div> | |
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin="" /> | |
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js" integrity="sha512-/Nsx9X4HebavoBvEBuyp3I7od5tA0UzAxs+j83KgC8PU0kgB4XiK4Lfe4y4cgBtaRJQEIFCW+oC506aPT2L1zw==" crossorigin=""></script> | |
<script type="text/javascript"> | |
var lat = 35.70603; | |
var lon = 51.43588; | |
// initialize map | |
map = L.map('to_hell_with_g_map').setView([lat, lon], 19); | |
// set map tiles source | |
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { | |
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors', | |
maxZoom: 18, | |
}).addTo(map); | |
// add marker to the map | |
marker = L.marker([lat, lon]).addTo(map); | |
// add popup to the marker | |
marker.bindPopup("<center>هر جایی<br /><b>که میخوای</b></center>").openPopup(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment