-
Notifications
You must be signed in to change notification settings - Fork 0
/
police6.js
executable file
·109 lines (98 loc) · 2.93 KB
/
police6.js
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
var debug = {};
var map = L.map('map',{
center: [36.131, 140.241],
zoom: 11,
minZoom: 6,
maxZoom: 16,
contextmenu: true,
contextmenuWidth: 180,
contextmenuItems: [{
text: 'この地点を地図の中央に指定',
callback: setCenterMap
},
{
text: '取得(地図中央1km範囲)',
callback: showLatLng
},
{
text: '取得(地図中央3km範囲)',
callback: showLatLng3
},
{
text: '取得(地図中央5km範囲)',
callback: showLatLng5
},
{
text: '取得(地図中央10km範囲)',
callback: showLatLng10
},
{
text: '取得(地図中央20km範囲)',
callback: showLatLng20
}]
});
function showLatLng (e) {
location.href = "http://surveyor.mydns.jp/unMapped/api/kmz/police?latlng="+ e.latlng +"&km=1";
}
function showLatLng3 (e) {
location.href = "http://surveyor.mydns.jp/unMapped/api/kmz/police?latlng="+ e.latlng +"&km=3";
}
function showLatLng5 (e) {
location.href = "http://surveyor.mydns.jp/unMapped/api/kmz/police?latlng="+ e.latlng +"&km=5";
}
function showLatLng10 (e) {
location.href = "http://surveyor.mydns.jp/unMapped/api/kmz/police?latlng="+ e.latlng +"&km=10";
}
function showLatLng20 (e) {
location.href = "http://surveyor.mydns.jp/unMapped/api/kmz/police?latlng="+ e.latlng +"&km=20";
}
function setCenterMap (e) {
map.panTo(e.latlng);
}
map.locate({setView: true, maxZoom: 16, timeout: 20000});
//OSMレイヤー追加
var osm = L.tileLayer(
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a>',
maxZoom: 16
}
);
osm.addTo(map);
var mvtSource0 = new L.TileLayer.MVTSource({
url: "https://yuuhayashi.github.io/coverageWeb/tiles/tilePolice6z/{z}/{x}/{y}.pbf",
style: function (feature) {
var style = {};
style.color = 'rgba(255,0,0,1)';
style.radius = 5;
style.selected = {
radius: 6
};
return style;
}
});
map.addLayer(mvtSource0);
var mvtSource1 = new L.TileLayer.MVTSource({
url: "https://yuuhayashi.github.io/coverageWeb/tiles/tilePolice6/{z}/{x}/{y}.pbf",
style: function (feature) {
var style = {};
style.color = 'rgba(0,255,0,1)';
style.radius = 5;
style.selected = {
radius: 6
};
return style;
}
});
map.addLayer(mvtSource1);
//Globals that we can change later.
var fillColor = 'rgba(149,139,255,0.4)';
var strokeColor = 'rgb(20,20,20)';
//Add layer
mvtSource1.addTo(map);
mvtSource0.addTo(map);
L.control.scale({imperial:false}).addTo(map);
// MapCenterCoord
var options = {
position: 'bottomleft' // 'topleft', 'topright', 'bottomleft' (default) ,'bottomright'
}
L.control.mapCenterCoord(options).addTo(map);