forked from hbz/swib16-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkoeln.html
38 lines (38 loc) · 1.62 KB
/
koeln.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Libraries in Cologne</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
</head>
<body style="color: white; background: #004678">
<h1>Libraries in Köln</h1>
<div id="map" style="height: 500px; color: black;"></div>
<script>
// we create a map:
var map = L.map('map').setView([50.942222222222, 6.9577777777778], 13);
var layer = L.tileLayer('https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png').addTo(map);
// we call the lobid API:
$.ajax({
url: 'https://beta.lobid.org/organisations/search?format=json&size=20&q=type:Library+AND+location.address.addressLocality:Köln',
success: function(result){
// iterate over all hits...
$.each(result, function(index, hit) {
// if we have a location field...
if(hit.location) {
// iterate over all locations of each hit...
$.each(hit.location, function(index, location) {
// if we have a geo location field...
if(location.geo) {
// we create a marker on our map, with a popup to show the name:
L.marker([location.geo.lat, location.geo.lon]).bindPopup(hit.name).addTo(map);
}
});
}
});
}});
</script>
</body>
</html>