From 8eb32a7706495a3d9f031c202548f2cfe7615966 Mon Sep 17 00:00:00 2001 From: tix Date: Sun, 12 Feb 2017 21:26:00 +0800 Subject: [PATCH] + loadStaticMap() --- public/js/mod.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/public/js/mod.js b/public/js/mod.js index bc2528a..6ff44a2 100644 --- a/public/js/mod.js +++ b/public/js/mod.js @@ -25,6 +25,40 @@ function onEachFeature(feature, layer) { // $(this).addClass("active"); // }); +function loadStaticMap() { + var base_map = L.tileLayer('http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { + maxZoom: 18 + }); + + var over_geojson_sjy_bound_2nd = new L.GeoJSON.AJAX("/json/sjy_bound_2nd.geojson", { + style: { + "color": "#de950d", + "weight": 2, + "opacity": 1, + "fillOpacity": 0 + } + }); + + var map = L.map('map', { + layers: [ + base_map, + over_geojson_sjy_bound_2nd + ], + minZoom: 6, + maxZoom: 17, + zoomIn: 1, + zoomOut: 1, + zoomControl: false + }).setView([34, 96], 6); + + var bounds = new L.LatLngBounds(new L.LatLng(31, 103), new L.LatLng(38, 89)); + map.fitBounds(bounds); + + $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { + map.invalidateSize(); + }); +} + function loadStationMap(station) { var base_map = L.tileLayer('http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', { maxZoom: 18