Skip to content

Instantly share code, notes, and snippets.

@psrdotcom
Created January 6, 2020 12:12
Show Gist options
  • Save psrdotcom/85c56bc2ffaadb254e63bde2b3b162d5 to your computer and use it in GitHub Desktop.
Save psrdotcom/85c56bc2ffaadb254e63bde2b3b162d5 to your computer and use it in GitHub Desktop.
Geo Location Test using Leaflet JavaScript
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>PSR Geo Location Test</TITLE>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"
integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
crossorigin=""></script>
</HEAD>
<BODY>
<div id="mapid" style="width: 600px; height: 400px;"></div>
<script>
var mymap = L.map('mapid').setView([17.496380,78.393175], 15);
var marker = L.marker([17.496380,78.393175]).addTo(mymap);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: 'mapbox/streets-v11'
}).addTo(mymap);
marker.bindPopup("<b>Hello !!</b><br>This is JNTU, Hyderabad, India Campus.").openPopup();
</script>
</BODY>
</HTML>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment