/
simple3dmap.html
73 lines (64 loc) · 1.91 KB
/
simple3dmap.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
72
73
<!DOCTYPE html><html lang="ja"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width">
<title>越前市役所VRマップ</title>
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<script src="https://unpkg.com/three@0.106.2/build/three.min.js"></script>
<script src="https://unpkg.com/three@0.106.2/examples/js/loaders/GLTFLoader.js"></script>
<div id='map'></div>
<script type="module">
import { maplibregl } from "https://taisukef.github.io/maplibre-gl-js/maplibre-gl-es.js";
//import * as THREE from "https://cdn.skypack.dev/three@0.136.0";
//import { GLTFLoader } from 'https://cdn.skypack.dev/three@0.136.0/examples/jsm/loaders/GLTFLoader.js';
//THREE.GLTFLoader = GLTFLoader;
import { getModelLayer } from "./getModelLayer.js";
const center = [35.90386982829044, 136.1689151035864];
const map = new maplibregl.Map({
container: 'map',
hash: true,
//style: 'https://taisukef.github.io/gsivectortile-3d-like-building/building3d.json',
style: "./mapsetting_nobigbuilding.json",
center: [center[1], center[0]], // opposite!
zoom: 15,
minZoom: 4,
maxZoom: 17.99,
bearing: -40,
pitch: 60,
doubleClickZoom: false,
localIdeographFontFamily: false
});
//UI
map.addControl(new maplibregl.NavigationControl(), 'bottom-right');
map.addControl(new maplibregl.ScaleControl());
map.showTileBoundaries = false;
map.showCollisionBoxes = false;
map.on('style.load', () => {
// 越前市役所
map.addLayer(getModelLayer(
map,
"echizen-city",
"https://code4fukui.github.io/glb-viewer/echizen-cityhall-all.glb",
35.90386982829044 - .0002, 136.1689151035864 + .0001,
0, 0, 3.0e-8
));
/*
// 鯖江市役所
map.addLayer(getThreeDLayer(
"sabae-city",
"https://code4fukui.github.io/glb-viewer/sabae-city.glb",
35.95663657976263, 136.1839217677216,
0, Math.PI / 2,
));
*/
});
</script>