Skip to content

Instantly share code, notes, and snippets.

@mohas
Created May 15, 2020 15:25
Show Gist options
  • Save mohas/71232c38e7d7263a169da37f286d1963 to your computer and use it in GitHub Desktop.
Save mohas/71232c38e7d7263a169da37f286d1963 to your computer and use it in GitHub Desktop.
quick leaflet Setup
<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 &copy; <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