From d8ab0f0573647acea2bdae1c07ea4cccecb6ae0d Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 9 Feb 2013 23:29:41 +0000 Subject: Begin adding a minimap --- .gitmodules | 3 +++ index.html | 5 ++++- resources/leaflet-minimap | 1 + resources/map.js | 10 ++++++++-- 4 files changed, 16 insertions(+), 3 deletions(-) create mode 160000 resources/leaflet-minimap diff --git a/.gitmodules b/.gitmodules index 96e85b2..377a496 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "resources/leaflet-hash"] path = resources/leaflet-hash url = git://github.com/mlevans/leaflet-hash.git +[submodule "resources/leaflet-minimap"] + path = resources/leaflet-minimap + url = git://github.com/Norkart/Leaflet-MiniMap.git diff --git a/index.html b/index.html index 135c256..3e96e9d 100644 --- a/index.html +++ b/index.html @@ -13,11 +13,14 @@ - + + + + diff --git a/resources/leaflet-minimap b/resources/leaflet-minimap new file mode 160000 index 0000000..e1cc0a5 --- /dev/null +++ b/resources/leaflet-minimap @@ -0,0 +1 @@ +Subproject commit e1cc0a5978e6fd68642e5e276a77c7563b7df774 diff --git a/resources/map.js b/resources/map.js index 7ec9cf5..1e962af 100644 --- a/resources/map.js +++ b/resources/map.js @@ -121,9 +121,12 @@ function catchmentAreaProperties(catchmentArea, healthPost) { } function initMap(self) { - self.tileLayer = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + var tileUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; + var tileAttribution = 'Map data © OpenStreetMap contributors'; + + self.tileLayer = L.tileLayer(tileUrl, { maxZoom: 18, - attribution: 'Map data © OpenStreetMap contributors' + attribution: tileAttribution }); // Create the map @@ -134,6 +137,9 @@ function initMap(self) { var hash = new L.Hash(map); + var miniMapTileLayer = new L.TileLayer(tileUrl, {minZoom: 0, maxZoom: 13, attribution: tileAttribution }); + var miniMap = new L.Control.MiniMap(miniMapTileLayer, { toggleDisplay: true }).addTo(map); + self.amenitiesShown = ["hospital"]; self.amenities = {}; self.amenityLayers = {}; // contains the layers for each amenity type -- cgit v1.2.3