loubnabnl HF staff commited on
Commit
6eb804c
1 Parent(s): 86a34e4

Create map_utils.py

Browse files
Files changed (1) hide show
  1. src/map_utils.py +102 -0
src/map_utils.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from branca.element import Template, MacroElement
2
+
3
+
4
+ template = """
5
+ {% macro html(this, kwargs) %}
6
+
7
+ <!doctype html>
8
+ <html lang="en">
9
+ <head>
10
+ <meta charset="utf-8">
11
+ <meta name="viewport" content="width=device-width, initial-scale=1">
12
+ <title>jQuery UI Draggable - Default functionality</title>
13
+ <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
14
+
15
+ <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
16
+ <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
17
+
18
+ <script>
19
+ $( function() {
20
+ $( "#maplegend" ).draggable({
21
+ start: function (event, ui) {
22
+ $(this).css({
23
+ right: "auto",
24
+ top: "auto",
25
+ bottom: "auto"
26
+ });
27
+ }
28
+ });
29
+ });
30
+
31
+ </script>
32
+ </head>
33
+ <body>
34
+
35
+
36
+ <div id='maplegend' class='maplegend'
37
+ style='position: absolute; z-index:9999; border:2px solid grey; background-color:rgba(255, 255, 255, 0.8);
38
+ border-radius:6px; padding: 10px; font-size:14px; right: 20px; bottom: 20px;'>
39
+
40
+ <div class='legend-title'>Legend / مفتاح الخريطة</div>
41
+ <div class='legend-scale'>
42
+ <ul class='legend-labels'>
43
+ <li><span style='background:#CE3C28;opacity:0.7;'></span>Rescue / إغاثة</li>
44
+ <li><span style='background:#ED922E;opacity:0.7;'></span>Medical Assistance / مساعدة طبية</li>
45
+ <li><span style='background:#FFCA92;opacity:0.7;'></span>Shelter / مأوى</li>
46
+ <li><span style='background:#37A8DA;opacity:0.7;'></span>Food & Water / طعام وماء</li>
47
+ <li><span style='background:#575757;opacity:0.7;'></span>Danger / مخاطر (تسرب الغاز، تلف في الخدمات العامة...)</li>
48
+ <li><span style='background:#6EAA25;opacity:0.7;'></span>Done / تم</li>
49
+ <li><span style='background:#FF91E8;opacity:0.7;'></span>Planned / مخطط لها</li>
50
+ </ul>
51
+ </div>
52
+ </div>
53
+
54
+ </body>
55
+ </html>
56
+
57
+ <style type='text/css'>
58
+ .maplegend .legend-title {
59
+ text-align: left;
60
+ margin-bottom: 5px;
61
+ font-weight: bold;
62
+ font-size: 90%;
63
+ color: #333;
64
+ }
65
+ .maplegend .legend-scale ul {
66
+ margin: 0;
67
+ margin-bottom: 5px;
68
+ padding: 0;
69
+ float: left;
70
+ list-style: none;
71
+ }
72
+ .maplegend .legend-scale ul li {
73
+ font-size: 80%;
74
+ list-style: none;
75
+ margin-left: 0;
76
+ line-height: 18px;
77
+ margin-bottom: 2px;
78
+ color: #111;
79
+ }
80
+ .maplegend ul.legend-labels li span {
81
+ display: block;
82
+ float: left;
83
+ height: 16px;
84
+ width: 30px;
85
+ margin-right: 5px;
86
+ margin-left: 0;
87
+ border: 1px solid #999;
88
+ }
89
+ .maplegend .legend-source {
90
+ font-size: 80%;
91
+ color: #777;
92
+ clear: both;
93
+ }
94
+ .maplegend a {
95
+ color: #777;
96
+ }
97
+ </style>
98
+ {% endmacro %}"""
99
+ legend_macro = MacroElement()
100
+ legend_macro._template = Template(template)
101
+
102
+ __all__ = ["legend_macro"]