-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimg.html
93 lines (64 loc) · 2.33 KB
/
img.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html>
<head>
<title>static map example - luigigrillo.com </title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==" crossorigin=""></script>
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 98%;
width: 100vw;
}
</style>
</head>
<body>
<div id='map'></div>
<script>
var map = L.map('map', {
crs: L.CRS.Simple,
minZoom: -7
});
var yx = L.latLng;
var xy = function(x, y) {
if (L.Util.isArray(x)) { // When doing xy([x, y]);
return yx(x[1], x[0]);
}
return yx(y, x); // When doing xy(x, y);
};
var bounds = [xy(-25, -26.5), xy(1023, 1021.5)];
var image = L.imageOverlay('maps/Cartina-della-Sicilia-1024x792.jpg', bounds).addTo(map);
var ct = xy(875.007315, 468.999245 );
var me = xy(973.007975, 793.000643);
var pa = xy(384.004008, 766.000527);
var sr = xy(916.007591, 285.998455);
L.marker(ct).addTo(map).bindPopup('Catania');
L.marker(me).addTo(map).bindPopup('Messina');
L.marker(pa).addTo(map).bindPopup('Palermo');
L.marker(sr).addTo(map).bindPopup('Siracusa');
var travel = L.polyline([ct, me]).addTo(map);
var popup = L.popup();
function onMapClick(e) {
var html = "<form action=index.php method=GET> \
<table> \
<tr><td>Title </td><td><input type=textarea name=title> </td></tr> \
<tr><td>Author </td><td><input type=textarea name=author></td></tr> \
<tr><td><input type=submit></td><td></td></tr> \
</table> \
</form>";
popup
.setLatLng(e.latlng)
.setContent("I can look for books concerning this location: " + e.latlng.toString() + "<br> Great! Isn't it??" + html)
.openOn(map);
}
map.on('click', onMapClick);
map.setView(xy(542.832833, 570.360558), 0);
</script>
</body>
</html>