-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
242 lines (209 loc) · 9.77 KB
/
Copy pathindex.html
File metadata and controls
242 lines (209 loc) · 9.77 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>SBCM GLOBAL SCANNER v9.1</title>
<!-- MapLibre GL JS -->
<link href="https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css" rel="stylesheet" />
<script src="https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js"></script>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap" rel="stylesheet">
<style>
body { margin: 0; background: #050505; color: #fff; font-family: 'JetBrains Mono', monospace; overflow: hidden; }
#map { width: 100%; height: 100vh; }
/* UI: Glassmorphism Style */
#ui {
position: absolute; top: 15px; left: 15px; z-index: 10;
background: rgba(0, 0, 0, 0.75);
backdrop-filter: blur(12px); /* すりガラス効果 */
-webkit-backdrop-filter: blur(12px);
padding: 20px;
border: 1px solid rgba(255, 255, 255, 0.15);
border-left: 4px solid #00ffff; /* Cyberpunk Accent */
border-radius: 8px; width: 260px;
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
}
h1 {
margin: 0 0 5px 0; font-size: 1.1rem; color: #fff;
text-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
letter-spacing: 1px;
}
.sub { font-size: 0.65rem; color: #aaa; margin-bottom: 20px; letter-spacing: 0.5px; }
/* Legend Items */
.legend-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.75rem; }
.box { width: 12px; height: 12px; border-radius: 2px; box-shadow: 0 0 6px currentColor; }
/* Search Box */
.search-box {
display: flex; gap: 8px; margin-top: 20px;
border-top: 1px solid rgba(255,255,255,0.2); padding-top: 15px;
}
input {
background: rgba(255,255,255,0.05); border: 1px solid #444;
color: #fff; padding: 8px; width: 100%; border-radius: 4px;
font-family: inherit; font-size: 0.8rem;
}
input:focus { outline: none; border-color: #00ffff; }
button {
background: #00ffff; color: #000; border: none;
font-weight: bold; cursor: pointer; border-radius: 4px; padding: 0 12px;
transition: all 0.2s;
}
button:hover { background: #fff; box-shadow: 0 0 15px #00ffff; }
/* Loading Overlay */
#loading {
position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
z-index: 99; color: #00ffff; font-weight: bold;
text-shadow: 0 0 10px #00ffff; display: none;
}
</style>
</head>
<body>
<div id="loading">INITIALIZING SYSTEM...</div>
<div id="ui">
<h1>SBCM SCANNER</h1>
<div class="sub">INFRASTRUCTURE EFFICIENCY AUDITOR</div>
<div style="margin-top:10px;">
<!-- Gold: 生産拠点 -->
<div class="legend-row" style="color:#ffd700;">
<div class="box" style="background:#ffd700;"></div> <b>PRODUCTION (Gold)</b>
</div>
<!-- Cyan: 高密度 (タワマン/オフィス) -->
<div class="legend-row" style="color:#00ffff;">
<div class="box" style="background:#00ffff;"></div> DENSITY (High)
</div>
<!-- Green: 中密度 -->
<div class="legend-row" style="color:#00ff41;">
<div class="box" style="background:#00ff41;"></div> EFFICIENT (Mid)
</div>
<!-- Red: スプロール (低密度住宅) -->
<div class="legend-row" style="color:#D70040;">
<div class="box" style="background:#D70040;"></div> SPRAWL (Low)
</div>
</div>
<div class="search-box">
<input type="text" id="city-in" placeholder="Ex: Tokyo, Kawasaki">
<button onclick="jump()">GO</button>
</div>
</div>
<div id="map"></div>
<script>
document.getElementById('loading').style.display = 'block';
const map = new maplibregl.Map({
container: 'map',
style: 'https://tiles.openfreemap.org/styles/dark',
center: [139.7, 35.5], // Kawasaki (Demo Center)
zoom: 13.5,
pitch: 60,
bearing: -20,
antialias: true
});
map.addControl(new maplibregl.NavigationControl({ showCompass: true, showZoom: true }));
map.on('load', () => {
document.getElementById('loading').style.display = 'none';
// 0. CLEANUP: デフォルトの建物レイヤーを隠す
map.getStyle().layers.forEach(l => {
if (l['source-layer'] === 'building' || l.id.includes('building')) {
map.setLayoutProperty(l.id, 'visibility', 'none');
}
});
const src = Object.keys(map.getStyle().sources).find(k => map.getStyle().sources[k].type === 'vector');
if (!src) return;
// 1. LANDUSE (地面発光レイヤー)
// 工場や商業施設の「敷地」を黄色く光らせることで、タグのない工場も救済する
map.addLayer({
'id': 'sbcm-landuse',
'source': src,
'source-layer': 'landuse',
'type': 'fill',
'filter': ['in', 'class', 'industrial', 'commercial', 'retail', 'hospital', 'school', 'college', 'university', 'stadium'],
'paint': {
'fill-color': '#ffd700',
'fill-opacity': 0.3, // 0.3くらいが丁度いい(地面が見える)
'fill-outline-color': '#ffd700'
},
'beforeId': 'water' // 水面より下に描画
});
// 2. ROADS (コストの血管)
map.addLayer({
'id': 'sbcm-roads',
'source': src,
'source-layer': 'transportation',
'type': 'line',
'filter': ['in', 'class', 'motorway', 'trunk', 'primary', 'secondary'],
'paint': {
'line-color': '#0088ff',
'line-width': 1.5,
'line-opacity': 0.8,
'line-blur': 0.5
}
});
// 3. BUILDINGS (3Dボリューム)
map.addLayer({
'id': 'sbcm-buildings',
'source': src,
'source-layer': 'building',
'type': 'fill-extrusion',
'minzoom': 11,
'paint': {
// 高さがデータにない場合は5mと仮定
'fill-extrusion-height': ['coalesce', ['get', 'render_height'], ['get', 'height'], 5],
'fill-extrusion-base': ['coalesce', ['get', 'render_min_height'], ['get', 'min_height'], 0],
// --- SBCM Coloring Logic ---
'fill-extrusion-color': [
'case',
// Rule 1: PRODUCTION & INFRASTRUCTURE -> Gold (#ffd700)
// 工場、倉庫、商業、インフラ等は高さに関係なくGold
['any',
['match', ['get', 'class'], ['industrial','warehouse','commercial','retail','utility','transportation','school','hospital'], true, false],
['match', ['get', 'type'], ['industrial','warehouse','commercial'], true, false]
], '#ffd700',
// Rule 2: High Rise -> Cyan (#00ffff)
['>=', ['coalesce', ['get', 'render_height'], ['get', 'height'], 5], 30], '#00ffff',
// Rule 3: Mid Rise -> Green (#00ff41)
['>=', ['coalesce', ['get', 'render_height'], ['get', 'height'], 5], 10], '#00ff41',
// Rule 4: Low Rise / Sprawl -> Deep Red (#D70040)
'#D70040'
],
'fill-extrusion-opacity': 1.0,
// 立体感を強調する陰影設定
'fill-extrusion-vertical-gradient': true
}
});
});
// 検索機能 (FlyTo)
async function jump() {
const city = document.getElementById('city-in').value;
if(!city) return;
// Loading表示
const btn = document.querySelector('button');
const originalText = btn.innerText;
btn.innerText = '...';
btn.disabled = true;
try {
const res = await fetch(`https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(city)}&limit=1`);
const data = await res.json();
if(data.length > 0) {
map.flyTo({
center: [parseFloat(data[0].lon), parseFloat(data[0].lat)],
zoom: 14,
pitch: 60,
essential: true
});
} else {
alert("City not found");
}
} catch(e) {
console.error(e);
} finally {
btn.innerText = originalText;
btn.disabled = false;
}
}
// Enterキーで検索
document.getElementById('city-in').addEventListener('keypress', function (e) {
if (e.key === 'Enter') jump();
});
</script>
</body>
</html>