web-mapping-leaflet 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_includes/map.html +91 -36
- data/_sass/web-mapping-leaflet.scss +43 -1
- data/assets/countries.geojson +182 -0
- data/assets/css/images/fullscreen.png +0 -0
- data/assets/css/images/fullscreen@2x.png +0 -0
- data/assets/js/Leaflet.fullscreen.min.js +1 -0
- data/assets/polyline.geojson +8 -0
- data/assets/random.geojson +362 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa368a340b31d95e96481cd67f88df7af34b6859f04a3a3298ebab866a33c874
|
4
|
+
data.tar.gz: c2de1331aa90d555dc99567e76634df95f81ab0d5cf6f68d676e690106654989
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7752aae1b22149676330bd9e7fac057a59e5986b843f536964214bdb7e146b6450f0d889570bcf9099049639d468b515c5b8f4d86427820740c677320a9c9df
|
7
|
+
data.tar.gz: b053d124ca1129a35665e91ab2a4dabe4836ca96a5c069b0a6d3ded7522d5c1f2113cc98280eb934645bbbcf967d3a05513ca49276626b2de38ce344d3e2faf0
|
data/_includes/map.html
CHANGED
@@ -6,63 +6,118 @@
|
|
6
6
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
7
7
|
});
|
8
8
|
|
9
|
-
|
10
|
-
var
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
9
|
+
{% for map in site.data.map_config.param %}
|
10
|
+
var coords = [{{ map.lat }}, {{ map.long }}]; // the geographic center of our map
|
11
|
+
var zoomLevel = {{ map.zoom }}; // the map scale
|
12
|
+
|
13
|
+
var map = L.map('map', {
|
14
|
+
center: coords,
|
15
|
+
zoom: zoomLevel,
|
16
|
+
maxZoom: {{ map.maxZoom }},
|
17
|
+
minZoom: {{ map.minZoom }},
|
18
|
+
layers: OSM
|
19
|
+
});
|
20
|
+
{% endfor %}
|
18
21
|
|
19
|
-
//
|
20
|
-
var
|
21
|
-
|
22
|
-
fillColor: "#ff7800",
|
23
|
-
color: "#000",
|
24
|
-
weight: 1,
|
25
|
-
opacity: 1,
|
26
|
-
fillOpacity: 0.8
|
22
|
+
// load basemap
|
23
|
+
var baseMaps = {
|
24
|
+
"OpenStreetMap": OSM,
|
27
25
|
};
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
var
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
// configuration for point data
|
28
|
+
{% for i in site.data.map_data.geojson.point %}
|
29
|
+
var {{i.name}}Style = {
|
30
|
+
radius: {{ i.radius }},
|
31
|
+
fillColor: "{{ i.fillColor }}",
|
32
|
+
color: "{{ i.color }}",
|
33
|
+
weight: {{ i.weight }},
|
34
|
+
opacity: {{ i.opacity }},
|
35
|
+
fillOpacity: {{ i.fillOpacity }}
|
36
|
+
};
|
37
|
+
{% endfor %}
|
38
|
+
|
39
|
+
{% for i in site.data.map_data.geojson.point %}
|
40
|
+
var {{i.name}}_markerClusters = L.markerClusterGroup({showCoverageOnHover: false});
|
41
|
+
var {{i.name}}= L.geoJson(null, {
|
42
|
+
pointToLayer: function (feature, latlng) {
|
43
|
+
return L.circleMarker(latlng, {{i.name}}Style);
|
44
|
+
},
|
36
45
|
onEachFeature: function (feature, layer) {
|
37
46
|
var popupcontent = [];
|
38
47
|
for (var prop in feature.properties) {
|
39
48
|
popupcontent.push("<table class='table table-striped table-bordered table-condensed'>" + "<tr><th>" + prop + "</th><td>"+ feature.properties[prop] + "</td></tr>" + "<table>");
|
40
49
|
}
|
41
50
|
layer.bindPopup(popupcontent.join("<hr />"));
|
42
|
-
|
51
|
+
{{i.name}}_markerClusters.addLayer( layer )
|
43
52
|
} //end onEachFeature
|
44
53
|
|
45
54
|
});
|
46
|
-
|
47
|
-
|
48
|
-
$.getJSON("assets/cities.geojson", function (data) {
|
49
|
-
mydata.addData(data);
|
55
|
+
$.getJSON("{{ i.url }}", function (data) {
|
56
|
+
{{i.name}}.addData(data);
|
50
57
|
});
|
58
|
+
{% endfor %}
|
59
|
+
|
60
|
+
// configuration for line data
|
61
|
+
{% for i in site.data.map_data.geojson.line %}
|
62
|
+
var {{i.name}}= L.geoJson(null, {
|
63
|
+
style: function (feature) {
|
64
|
+
return {
|
65
|
+
color: "{{ i.color }}",
|
66
|
+
weight: {{ i.weight }},
|
67
|
+
dashArray: "{{ i.dashArray }}",
|
68
|
+
opacity: {{ i.opacity }},
|
69
|
+
};
|
70
|
+
},
|
71
|
+
onEachFeature: function (feature, layer) {
|
72
|
+
var popupcontent = [];
|
73
|
+
for (var prop in feature.properties) {
|
74
|
+
popupcontent.push("<table class='table table-striped table-bordered table-condensed'>" + "<tr><th>" + prop + "</th><td>"+ feature.properties[prop] + "</td></tr>" + "<table>");
|
75
|
+
}
|
76
|
+
layer.bindPopup(popupcontent.join("<hr />"));
|
77
|
+
} //end onEachFeature
|
51
78
|
|
79
|
+
});
|
80
|
+
$.getJSON("{{ i.url }}", function (data) {
|
81
|
+
{{i.name}}.addData(data);
|
82
|
+
});
|
83
|
+
{% endfor %}
|
84
|
+
|
85
|
+
// configuration for polygon data
|
86
|
+
{% for i in site.data.map_data.geojson.area %}
|
87
|
+
var {{i.name}}= L.geoJson(null, {
|
88
|
+
pointToLayer: function (feature, latlng) {
|
89
|
+
return L.circleMarker(latlng, {{i.name}}Style);
|
90
|
+
},
|
91
|
+
onEachFeature: function (feature, layer) {
|
92
|
+
var popupcontent = [];
|
93
|
+
for (var prop in feature.properties) {
|
94
|
+
popupcontent.push("<table class='table table-striped table-bordered table-condensed'>" + "<tr><th>" + prop + "</th><td>"+ feature.properties[prop] + "</td></tr>" + "<table>");
|
95
|
+
}
|
96
|
+
layer.bindPopup(popupcontent.join("<hr />"));
|
97
|
+
} //end onEachFeature
|
52
98
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
};
|
99
|
+
});
|
100
|
+
$.getJSON("{{ i.url }}", function (data) {
|
101
|
+
{{i.name}}.addData(data);
|
102
|
+
});
|
103
|
+
{% endfor %}
|
57
104
|
|
58
105
|
// load overlay
|
59
106
|
var overlay = {
|
60
|
-
|
107
|
+
{% for i in site.data.map_data.geojson.point %}
|
108
|
+
"{{i.name}}": {{i.name}}_markerClusters,
|
109
|
+
{% endfor %}
|
110
|
+
{% for i in site.data.map_data.geojson.line %}
|
111
|
+
"{{i.name}}": {{i.name}},
|
112
|
+
{% endfor %}
|
113
|
+
{% for i in site.data.map_data.geojson.area %}
|
114
|
+
"{{i.name}}": {{i.name}},
|
115
|
+
{% endfor %}
|
61
116
|
};
|
62
117
|
|
118
|
+
L.control.layers(baseMaps, overlay, {collapsed: true}).addTo(map);
|
63
119
|
|
64
|
-
|
120
|
+
map.addControl(new L.Control.Fullscreen());
|
65
121
|
|
66
|
-
L.control.layers(baseMaps, overlay, {collapsed: true}).addTo(map);
|
67
122
|
|
68
123
|
</script>
|
@@ -4,7 +4,6 @@
|
|
4
4
|
@import "https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.4.1/MarkerCluster.css";
|
5
5
|
@import "https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.4.1/MarkerCluster.Default.css";
|
6
6
|
|
7
|
-
|
8
7
|
$background-color : #f8f9fa ;
|
9
8
|
|
10
9
|
html, body, #container {
|
@@ -61,3 +60,46 @@ p, ul, ol, pre, blockquote {
|
|
61
60
|
.footer p {
|
62
61
|
font-size: 11px;
|
63
62
|
}
|
63
|
+
|
64
|
+
/* Leaflet fullscreen */
|
65
|
+
$assetPath : "images";
|
66
|
+
.leaflet-control-fullscreen a {
|
67
|
+
background: #fff url(#{$assetPath}/fullscreen.png) no-repeat 0 0;
|
68
|
+
background-size: 26px 52px;
|
69
|
+
}
|
70
|
+
|
71
|
+
.leaflet-touch .leaflet-control-fullscreen a {
|
72
|
+
background-position: 2px 2px;
|
73
|
+
}
|
74
|
+
|
75
|
+
.leaflet-fullscreen-on .leaflet-control-fullscreen a {
|
76
|
+
background-position: 0 -26px;
|
77
|
+
}
|
78
|
+
|
79
|
+
.leaflet-touch.leaflet-fullscreen-on .leaflet-control-fullscreen a {
|
80
|
+
background-position: 2px -24px;
|
81
|
+
}
|
82
|
+
|
83
|
+
/* Do not combine these two rules; IE will break. */
|
84
|
+
|
85
|
+
.leaflet-container {
|
86
|
+
&:-webkit-full-screen, &.leaflet-fullscreen-on {
|
87
|
+
width: 100% !important;
|
88
|
+
height: 100% !important;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
.leaflet-pseudo-fullscreen {
|
93
|
+
position: fixed !important;
|
94
|
+
width: 100% !important;
|
95
|
+
height: 100% !important;
|
96
|
+
top: 0 !important;
|
97
|
+
left: 0 !important;
|
98
|
+
z-index: 99999;
|
99
|
+
}
|
100
|
+
|
101
|
+
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
102
|
+
.leaflet-control-fullscreen a {
|
103
|
+
background-image: url(#{$assetPath}/fullscreen@2x.png);
|
104
|
+
}
|
105
|
+
}
|