64 lines
1.4 KiB
HTML
64 lines
1.4 KiB
HTML
|
<!doctype html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<style type="text/css">
|
||
|
body {
|
||
|
padding: 0;
|
||
|
margin: 0;
|
||
|
}
|
||
|
|
||
|
html, body, #map {
|
||
|
height: 100%;
|
||
|
}
|
||
|
|
||
|
</style>
|
||
|
|
||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.1.0/dist/leaflet.css"
|
||
|
integrity="sha512-wcw6ts8Anuw10Mzh9Ytw4pylW8+NAD4ch3lqm9lzAsTxg0GFeJgoAtxuCLREZSC5lUXdVyo/7yfsqFjQ4S+aKw=="
|
||
|
crossorigin=""/>
|
||
|
|
||
|
<script src="https://unpkg.com/leaflet@1.1.0/dist/leaflet.js"
|
||
|
integrity="sha512-mNqn2Wg7tSToJhvHcqfzLMU6J4mkOImSPTxVZAdo+lcPlk+GhZmYgACEe0x35K7YzW1zJ7XyJV/TT1MrdXvMcA=="
|
||
|
crossorigin=""></script>
|
||
|
</head>
|
||
|
|
||
|
|
||
|
|
||
|
<script src="https://code.jquery.com/jquery-2.1.0.min.js"></script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="map"></div>
|
||
|
<script>
|
||
|
|
||
|
|
||
|
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||
|
var osmAttrib='Data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
|
||
|
var osm = new L.TileLayer(osmUrl, {minZoom: 2, maxZoom: 8, attribution: osmAttrib});
|
||
|
|
||
|
|
||
|
|
||
|
$.getJSON("get-json.php", function(data) {
|
||
|
|
||
|
function onEachFeature(feature, layer) {
|
||
|
|
||
|
layer.bindPopup("Name: " + feature.properties.name + "<br>" + "Abbreviation: " + feature.properties.abbrev);
|
||
|
}
|
||
|
|
||
|
var geojson = L.geoJson(data, {
|
||
|
onEachFeature: onEachFeature
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
var map = L.map('map').fitBounds(geojson.getBounds());
|
||
|
|
||
|
osm.addTo(map);
|
||
|
geojson.addTo(map);
|
||
|
map.setView([51.8196, 10.6298], 4);
|
||
|
});
|
||
|
|
||
|
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|