|
9 | 9 | <script src="https://jieter.github.io/Leaflet.Sync/L.Map.Sync.js"></script>
|
10 | 10 |
|
11 | 11 | <style type="text/css">
|
12 |
| -html, body { width: 100%; height: 100%; margin: 0; } |
13 |
| -#map, #container { width: 50%; height: 100%; |
| 12 | +html, body { width: 100%; height: 100%; margin: 10; font-family: Arial } |
| 13 | +#map, #container { width: 50%; height: 90%; |
14 | 14 | }
|
15 | 15 | #map { float: left; }
|
16 | 16 | #container { float: right; }
|
17 |
| -#container .map { width: 100%; height: 50%; } |
| 17 | +#container .halfmap { width: 90%; height: 50%; } |
18 | 18 |
|
19 | 19 | #map { border-style: solid; border-width: 2px; border-color: black
|
20 | 20 | box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box;}
|
|
27 | 27 | </head>
|
28 | 28 |
|
29 | 29 | <body>
|
| 30 | +<h2>Pune Prabhag boundaries : three layouts over 15 years, synchronized maps.</h2> |
| 31 | + |
30 | 32 | <div id="map"></div>
|
31 | 33 | <div id="container">
|
32 |
| -<div id="mapA" class="map"></div> |
33 |
| -<div id="mapB" class="map"></div> |
| 34 | +<div id="mapA" class="halfmap"></div> |
| 35 | +<div id="mapB" class="halfmap"></div> |
34 | 36 | </div>
|
35 | 37 |
|
| 38 | +<br> <br> |
| 39 | +<p>Instructions: Click/touch and drag to move the map around. Use the zoom control on top left or +/- keys to zoom in or out. All three maps will move together. The circles tell which area the mouse is currently hovering on.</p> |
| 40 | +<p>Click on links to download the shape files.: Green : <a href="maps/pune.2017.wards.geojson">2017-present</a> (41 prahags) | Blue: <a href="maps/pune.2012-17.wards.geojson">2012-17</a> (76 prabhags) | Red: <a href="maps/pune.pre-2012.wards.geojson:">Pre-2012</a> (144 Prabhags). <br>The 2011 Census data for Pune is as per the pre-2012 144 prabhags.</p> |
| 41 | +<p>Map prepared by Nikhil VJ, Pune. Contact : nikhil.js [at] gmail.com. Using Leaflet, <a href="http://leafletjs.com/plugins.html#minimaps--synced-maps">Leaflet.Sync</a> plugin and Scenic tileset from Mapbox. <a href="https://github.com/answerquest/answerquest.github.io/blob/master/pune_07-12-17_sync.html" target="_blank">See the code on github</a>. |
| 42 | +<br><br><br> |
| 43 | + |
| 44 | + |
| 45 | + |
36 | 46 | <script type="text/javascript">
|
37 | 47 | var DATAPATH = "maps/"
|
38 | 48 | var center = [18.53, 73.85]; //Pune
|
|
41 | 51 | var MBAttrib = '© ' + osmLink + ' Contributors & <a href="https://www.mapbox.com/about/maps/">Mapbox</a>';
|
42 | 52 | var mapboxUrl = 'https://api.mapbox.com/styles/v1/mapbox/streets-v10/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoibmlraGlsc2hldGgiLCJhIjoiQTREVlJuOCJ9.YpMpVVbkxOFZW-bEq1_LIw'; // from Mapbox account
|
43 | 53 |
|
44 |
| -var MBstreets = L.tileLayer(mapboxUrl, {attribution: MBAttrib}); |
45 |
| -var MBstreetsA = L.tileLayer(mapboxUrl, {attribution: MBAttrib}); |
| 54 | +var scenic = 'https://api.mapbox.com/styles/v1/nikhilsheth/cj8rdd7wu45nl2sps9teusbbr/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoibmlraGlsc2hldGgiLCJhIjoiQTREVlJuOCJ9.YpMpVVbkxOFZW-bEq1_LIw' ; |
| 55 | + |
| 56 | +var MBstreets = L.tileLayer(scenic, {attribution: MBAttrib}); |
| 57 | +var MBstreetsA = L.tileLayer(scenic, {attribution: MBAttrib}); |
46 | 58 | var MBstreetsB = L.tileLayer(mapboxUrl, {attribution: MBAttrib});
|
47 | 59 |
|
48 | 60 | var map = L.map('map', {
|
49 | 61 | layers: [MBstreets],
|
50 | 62 | center: center,
|
| 63 | +scrollWheelZoom: false, |
51 | 64 | zoom: 12
|
52 | 65 | });
|
53 | 66 |
|
54 | 67 | var mapA = L.map('mapA', {
|
55 | 68 | layers: [MBstreetsA],
|
56 | 69 | center: center,
|
57 | 70 | zoom: 12,
|
| 71 | +scrollWheelZoom: false, |
58 | 72 | zoomControl: false
|
59 | 73 | });
|
60 | 74 |
|
61 | 75 | var mapB = L.map('mapB', {
|
62 | 76 | layers: [MBstreetsB],
|
63 | 77 | center: center,
|
64 | 78 | zoom: 12,
|
| 79 | +scrollWheelZoom: false, |
65 | 80 | zoomControl: false
|
66 | 81 | });
|
67 | 82 |
|
|
86 | 101 | style: {weight: 1.5, opacity: 1, color: 'green', dashArray: '0', fillOpacity: 0.0 },
|
87 | 102 | onEachFeature: onEachFeature
|
88 | 103 | }).addTo(map);
|
89 |
| -omnivore.geojson(DATAPATH+'pune2017_22_wards_corporators.geojson', null, wards); |
| 104 | +omnivore.geojson(DATAPATH+'pune.2017.wards.geojson', null, wards); |
90 | 105 | layerControl.addOverlay(wards , "2017 Prabhags (41)");
|
91 | 106 |
|
92 | 107 |
|
93 | 108 | var wardsA = L.geoJson(null, {
|
94 | 109 | style: {weight: 1.5, opacity: 1, color: 'blue', dashArray: '0', fillOpacity: 0.0 },
|
95 | 110 | onEachFeature: onEachFeatureA
|
96 | 111 | }).addTo(mapA);
|
97 |
| -omnivore.geojson(DATAPATH+'pune-2012-17-prabhags.geojson', null, wardsA); |
| 112 | +omnivore.geojson(DATAPATH+'pune.2012-17.wards.geojson', null, wardsA); |
98 | 113 | layerControlA.addOverlay(wardsA , "2012-17 Prabhags (76)");
|
99 | 114 |
|
100 | 115 | var wardsB = L.geoJson(null, {
|
101 | 116 | style: {weight: 1.5, opacity: 1, color: '#d55d5d', dashArray: '0', fillOpacity: 0.0 },
|
102 | 117 | onEachFeature: onEachFeatureB
|
103 | 118 | }).addTo(mapB);
|
104 |
| -omnivore.geojson(DATAPATH+'pune pre-2012 144prabhags.geojson', null, wardsB); |
105 |
| -layerControlB.addOverlay(wardsB , "2007-12 Prabhags (144)"); |
| 119 | +omnivore.geojson(DATAPATH+'pune.pre-2012.wards.geojson', null, wardsB); |
| 120 | +layerControlB.addOverlay(wardsB , "pre-2012 Prabhags (144)"); |
106 | 121 |
|
107 | 122 | function onEachFeature(feature, layer) {
|
108 |
| - var popupText = feature.properties['prabhag_number'].toString() + ": " + feature.properties['prabhag_name']; |
| 123 | + var popupText = '<big><b>' + feature.properties['prabhag_number'].toString() + "</b>: " + feature.properties['prabhag_name'] + |
| 124 | + '</big>'; |
| 125 | + |
109 | 126 | layer.bindTooltip(popupText,
|
110 | 127 | { sticky: true }) // to follow the mouse
|
111 | 128 | .addTo(map);
|
112 |
| - // https://gis.stackexchange.com/a/245183/44746 |
113 |
| - // .toString() has to be added when taking only a numerical feature.properties.var as tooltip text, from https://gis.stackexchange.com/questions/241739/removing-tooltip-label-border-completely-in-leaflet-js-map |
114 | 129 | }
|
| 130 | + // tooltip syntax: https://gis.stackexchange.com/a/245183/44746 |
| 131 | + // .toString() has to be added when taking only a numerical feature.properties.var as tooltip text, from |
115 | 132 |
|
116 | 133 | function onEachFeatureA(feature, layer) {
|
117 |
| - var popupText = feature.properties['wardnum'].toString() + ": " + feature.properties['title']; |
| 134 | + var popupText = '<big><b>' + feature.properties['wardnum'].toString() + "</b>: " + feature.properties['title'] + '</big>'; |
118 | 135 | layer.bindTooltip(popupText,
|
119 | 136 | { sticky: true }) // to follow the mouse
|
120 | 137 | .addTo(mapA);
|
121 |
| - // https://gis.stackexchange.com/a/245183/44746 |
122 |
| - // .toString() has to be added when taking only a numerical feature.properties.var as tooltip text, from https://gis.stackexchange.com/questions/241739/removing-tooltip-label-border-completely-in-leaflet-js-map |
123 | 138 | }
|
124 | 139 |
|
125 | 140 | function onEachFeatureB(feature, layer) {
|
126 |
| - var popupText = feature.properties['wardnum'].toString(); |
| 141 | + var popupText = '<big><b>' + feature.properties['wardnum'].toString() + '</b></big>'; |
127 | 142 | layer.bindTooltip(popupText,
|
128 | 143 | { sticky: true }) // to follow the mouse
|
129 | 144 | .addTo(mapB);
|
130 |
| - // https://gis.stackexchange.com/a/245183/44746 |
131 |
| - // .toString() has to be added when taking only a numerical feature.properties.var as tooltip text, from https://gis.stackexchange.com/questions/241739/removing-tooltip-label-border-completely-in-leaflet-js-map |
132 | 145 | }
|
133 | 146 |
|
134 | 147 | </script>
|
|
0 commit comments