Skip to content

Commit 2bb6517

Browse files
authored
cleaner template (#688)
1 parent 9fcf02d commit 2bb6517

File tree

1 file changed

+65
-74
lines changed

1 file changed

+65
-74
lines changed

folium/templates/fol_template.html

Lines changed: 65 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,78 @@
11
<!DOCTYPE html>
22
<head>
3-
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
4-
<script>L_PREFER_CANVAS=false; L_NO_TOUCH=false; L_DISABLE_3D=false;</script>
5-
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js"></script>
6-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
7-
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
8-
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>
9-
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.0.0/leaflet.markercluster.js"></script>
3+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
4+
<script>L_PREFER_CANVAS=false; L_NO_TOUCH=false; L_DISABLE_3D=false;</script>
5+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js"></script>
6+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
7+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
8+
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>
9+
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.0.0/leaflet.markercluster.js"></script>
1010

11-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css" />
12-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>
13-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>
14-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>
15-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>
16-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.0.0/MarkerCluster.Default.css"/>
17-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.0.0/MarkerCluster.css"/>
18-
<link rel="stylesheet" href="https://rawgit.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css"/>
19-
20-
<style>
21-
22-
html, body {
23-
width: 100%;
24-
height: 100%;
25-
margin: 0;
26-
padding: 0;
27-
}
28-
</style>
29-
<style>
30-
#map {
31-
position:absolute;
32-
top:0;
33-
bottom:0;
34-
right:0;
35-
left:0;
36-
}
37-
38-
</style>
39-
40-
<style>
41-
#{{ map_id }} {
42-
position:relative;
43-
{{ size }}
44-
left:0.0%;
45-
top:0.0%;
46-
}
47-
</style>
11+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css" />
12+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>
13+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>
14+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>
15+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>
16+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.0.0/MarkerCluster.Default.css"/>
17+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.0.0/MarkerCluster.css"/>
18+
<link rel="stylesheet" href="https://rawgit.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css"/>
4819

20+
<style>
21+
html, body {
22+
width: 100%;
23+
height: 100%;
24+
margin: 0;
25+
padding: 0;
26+
}
27+
</style>
28+
<style>
29+
#map {
30+
position:absolute;
31+
top:0;
32+
bottom:0;
33+
right:0;
34+
left:0;
35+
}
36+
</style>
37+
<style>
38+
#{{ map_id }} {
39+
position:relative;
40+
{{ size }}
41+
left:0.0%;
42+
top:0.0%;
43+
}
44+
</style>
4945
</head>
5046

5147
<body>
52-
53-
<div class="folium-map" id="{{ map_id }}" ></div>
54-
48+
<div class="folium-map" id="{{ map_id }}" ></div>
5549
</body>
5650

5751
<script>
52+
var southWest = L.latLng({{ min_lat }}, {{ min_lon }});
53+
var northEast = L.latLng({{ max_lat }}, {{ max_lon }});
54+
var bounds = L.latLngBounds(southWest, northEast);
5855

59-
var southWest = L.latLng({{ min_lat }}, {{ min_lon }});
60-
var northEast = L.latLng({{ max_lat }}, {{ max_lon }});
61-
var bounds = L.latLngBounds(southWest, northEast);
62-
63-
var {{ map_id }} = L.map('{{ map_id }}', {
64-
center:[{{ lat }}, {{ lon }}],
65-
zoom: {{ zoom_level }},
66-
maxBounds: bounds,
67-
layers: [],
68-
worldCopyJump: {{ world_copy_jump.__str__().lower() }},
69-
crs: L.CRS.{{crs}}
70-
});
71-
72-
{% for tile in tile_layers %}
73-
var {{tile['id']}} = L.tileLayer(
74-
'{{tile['address']}}',
75-
{
76-
maxZoom: {{tile['max_zoom']}},
77-
minZoom: {{tile['min_zoom']}},
78-
continuousWorld: {{tile['continuous_world'].__str__().lower()}},
79-
noWrap: {{tile['no_wrap'].__str__().lower()}},
80-
attribution: '{{tile['attr']}}',
81-
detectRetina: {{tile['detect_retina'].__str__().lower()}},
82-
subdomains: '{{tile['subdomains']}}'
83-
}
84-
).addTo({{ map_id }});
85-
{% endfor %}
56+
var {{ map_id }} = L.map('{{ map_id }}', {
57+
center:[{{ lat }}, {{ lon }}],
58+
zoom: {{ zoom_level }},
59+
maxBounds: bounds,
60+
layers: [],
61+
worldCopyJump: {{ world_copy_jump.__str__().lower() }},
62+
crs: L.CRS.{{crs}}
63+
});
8664

65+
{% for tile in tile_layers %}
66+
var {{tile['id']}} = L.tileLayer(
67+
'{{tile['address']}}',
68+
{
69+
maxZoom: {{tile['max_zoom']}},
70+
minZoom: {{tile['min_zoom']}},
71+
continuousWorld: {{tile['continuous_world'].__str__().lower()}},
72+
noWrap: {{tile['no_wrap'].__str__().lower()}},
73+
attribution: '{{tile['attr']}}',
74+
detectRetina: {{tile['detect_retina'].__str__().lower()}},
75+
subdomains: '{{tile['subdomains']}}'
76+
}).addTo({{ map_id }});
77+
{% endfor %}
8778
</script>

0 commit comments

Comments
 (0)