-
Notifications
You must be signed in to change notification settings - Fork 0
/
piclocation.html
71 lines (67 loc) · 2.97 KB
/
piclocation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0,user-scalable=no"/>
<title>地图位置</title>
<link href="leaflet.css" rel="stylesheet">
<script src='leaflet-src.js'></script>
<style>
html,body{height:100%;margin:0;padding:0;}
.popup_diy .leaflet-popup-content{margin:5px;}
.popup_diy .leaflet-popup-content-wrapper{border-radius:0px !important;}
</style>
</head>
<body>
<div id="map" class="wechat-loading" style="height:100%;width:100%;"></div>
<script>
var u_O = {}, x = window.location.search.substring(1).split('&');
for(var k in x){
var a = x[k].split('=')
u_O[a[0]] = a[1];
}
var picError = function(ele){
ele.parentNode.innerHTML = '图片已过期'
}
var black = L.tileLayer('http://{s}.tiles.mapbox.com/v3/spatialdev.map-c9z2cyef/{z}/{x}/{y}.png', {maxZoom: 19})
var road = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {maxZoom: 19})
var google = L.tileLayer('http://mt{s}.google.cn/vt/lyrs=m&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}', {maxZoom: 19, subdomains:'123'})
// var satellite = L.tileLayer('http://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}', {maxZoom: 19, subdomains:'123'})
var satellite = L.tileLayer('http://mt{s}.google.cn/vt/lyrs=s&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}', {maxZoom: 19, subdomains:'123'})
var tianMap = L.tileLayer('http://t7.tianditu.com/DataServer?T=vec_w&x={x}&y={y}&l={z}', {maxZoom: 19, subdomains:'1234567'})
var areaName = L.tileLayer('http://t{s}.tianditu.com/DataServer?T=cva_w&x={x}&y={y}&l={z}', {maxZoom: 19, subdomains:'1234567'})
var map = L.map('map', {
center: [32.76880048488168, 97.119140625],
zoom: 3,
layers: [black],
zoomControl: false,
attributionControl: false
})
var baseMaps = {
"炫酷黑": black,
"天地图": tianMap,
"道路图": road,
// "卫星图": satellite,
// "google": google
};
var overlays = {
"地名": areaName
};
L.control.layers(baseMaps, overlays).addTo(map)
if(u_O.lng && u_O.lat){
var marker = L.marker(u_O).addTo(map)
var height = 220, width = 220
if (u_O.width && u_O.height) {
var rate = Math.min(220/u_O.width, 220/u_O.height)
height = u_O.height * rate
width = u_O.width * rate
}
if (u_O.img) {
marker.bindPopup('<div class="popupImg" style="height:'+height+'px;width:'+width+'px;overflow:hidden;background:#f3f3f3;text-align:center;line-height:'+ height +'px;color:#aaa;position:relative;"><span style="position:absolute;width:100%;height:30px;line-height:30px;bottom:0;left:0;text-align:center;color:white;text-shadow:0 0 8px black;">'+ decodeURIComponent(u_O.time) +'</span><img onerror="picError(this)" style="max-width:220px;max-height:220px;height:'+height+'px;width:'+width+'px;display:block;margin:auto;" src="'+u_O.img+'"></div>',{offset:[0,-40],closeButton:false,className:'popup_diy'})
.openPopup();
}
map.setView(u_O, 17);
}
</script>
</body>
</html>