web-mapping-leaflet 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d85753cbbddf067e6697503f1accec8fb89acd1d3473c573b90176afa88b64f
4
- data.tar.gz: 432ce0827a159d22815f4817fe1c8da2180b702c7a5dd4cf94c26b62bfa7097e
3
+ metadata.gz: aa368a340b31d95e96481cd67f88df7af34b6859f04a3a3298ebab866a33c874
4
+ data.tar.gz: c2de1331aa90d555dc99567e76634df95f81ab0d5cf6f68d676e690106654989
5
5
  SHA512:
6
- metadata.gz: 67e719b5aa02b2134f09ebe7680a86f35db1e73bf514f7e1f085c2f76bd89ea4c1fdab9ac46c89390276e2b7518e91d9899af086b914c3b48432bef8bdbd98c1
7
- data.tar.gz: 6e73ee3ee9c8aeab020ca8bef0b3eb9c49416595f8f03fe073369e5f6c1028e7e3c8eb25569642e1e6bba25c8a0f1ea19739db5cb08b97d09fb595c95b70e596
6
+ metadata.gz: f7752aae1b22149676330bd9e7fac057a59e5986b843f536964214bdb7e146b6450f0d889570bcf9099049639d468b515c5b8f4d86427820740c677320a9c9df
7
+ data.tar.gz: b053d124ca1129a35665e91ab2a4dabe4836ca96a5c069b0a6d3ded7522d5c1f2113cc98280eb934645bbbcf967d3a05513ca49276626b2de38ce344d3e2faf0
data/_includes/map.html CHANGED
@@ -6,63 +6,118 @@
6
6
  attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
7
7
  });
8
8
 
9
- var coords = [0, 0]; // the geographic center of our map
10
- var zoomLevel = 3; // the map scale
11
- // var map = L.map('map', {
12
- // center: coords,
13
- // zoom: zoomLevel,
14
- // layers: OSM
15
- // });
16
-
17
- var map = L.map('map',{layers: OSM}).setView(coords, zoomLevel);
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
- //Styles
20
- var geojsonMarkerOptions = {
21
- radius: 8,
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
- var markerClusters = L.markerClusterGroup({showCoverageOnHover: false});
30
-
31
- var mydata= L.geoJson(null, {
32
- // pointToLayer: function (feature, latlng) {
33
- // return L.circleMarker(latlng, geojsonMarkerOptions);
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
- markerClusters.addLayer( layer )
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
- // load basemap
54
- var baseMaps = {
55
- "OpenStreetMap": OSM,
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
- "Cities": markerClusters,
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
- // markerClusters.addLayer( mydata );
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
+ }