Basic map with Leaflet.js and OpenStreetMap
Leaflet is an an open-source JavaScript library for mobile-friendly interactive maps http://leafletjs.com/ Here data is provided by OpenStreetMap
by kmg747
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-beta.2.rc.2/leaflet.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.0-beta.2.rc.2/leaflet.css">
<div id="map"></div>
9.4780° S, 147.1507° E
CSS
#map {
height: 330px;
width: 330px;
}
JavaScript
// center of the map
var center = [-9.4780, 147.1507];
// Create the map
var map = L.map('map').setView(center, 12);
// Set up the OSM layer
L.tileLayer(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18
}).addTo(map);
// add a marker in the given location
//L.marker(center).addTo(map);