109 lines
2.5 KiB
JavaScript
109 lines
2.5 KiB
JavaScript
$('.navbar-nav li a').each(function () {
|
|
if ($($(this))[0].href == String(window.location)) {
|
|
$(this).parent().addClass('active');
|
|
}
|
|
else if (window.location.pathname == '/') {
|
|
$('.navbar-nav li').first().addClass('active');
|
|
}
|
|
else {
|
|
$('.navbar-nav li').first().removeClass('active');
|
|
}
|
|
});
|
|
|
|
function onEachFeature(feature, layer) {
|
|
var out = [];
|
|
if (feature.properties) {
|
|
for (var key in feature.properties) {
|
|
out.push(key + ": " + feature.properties[key]);
|
|
}
|
|
}
|
|
layer.bindPopup(out.join("<br />"));
|
|
}
|
|
|
|
// $(document).on('click', '.navbar-nav li', function () {
|
|
// $(".nav-list li").removeClass("active");
|
|
// $(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
|
|
});
|
|
|
|
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 over_geojson_station = new L.GeoJSON.AJAX("/api/gis/geojson/" + station, {
|
|
pointToLayer: function (feature, latlng) {
|
|
return L.circleMarker(latlng, {
|
|
radius: 4,
|
|
fillColor: "#0aff3c",
|
|
color: "#000",
|
|
weight: 1,
|
|
opacity: 1,
|
|
fillOpacity: 0.8
|
|
})
|
|
},
|
|
onEachFeature: onEachFeature
|
|
});
|
|
|
|
var map = L.map('map', {
|
|
layers: [
|
|
base_map,
|
|
over_geojson_sjy_bound_2nd,
|
|
over_geojson_station
|
|
],
|
|
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();
|
|
});
|
|
} |