Skip to content

Commit 574b2f9

Browse files
committed
addexample
1 parent 9f5cdf6 commit 574b2f9

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

example/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>maplibre-gl-gsi-terrain</title>
8+
</head>
9+
<body style="margin: 0">
10+
<div id="app" style="height: 100vh"></div>
11+
<script type="module" src="./index.ts"></script>
12+
</body>
13+
</html>

example/index.ts

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import maplibregl from 'maplibre-gl';
2+
import 'maplibre-gl/dist/maplibre-gl.css';
3+
import { useGsiTerrainSource } from '../src/terrain.ts';
4+
5+
const gsiTerrainSource = useGsiTerrainSource(maplibregl.addProtocol, {
6+
tileUrl: 'https://tiles.gsj.jp/tiles/elev/mixed/{z}/{y}/{x}.png',
7+
maxzoom: 17,
8+
attribution:
9+
'<a href="https://gbank.gsj.jp/seamless/elev/">産総研シームレス標高タイル</a>',
10+
});
11+
12+
new maplibregl.Map({
13+
container: 'app',
14+
zoom: 13,
15+
center: [138.7, 35.3],
16+
minZoom: 5,
17+
maxZoom: 18,
18+
pitch: 70,
19+
maxPitch: 100,
20+
style: {
21+
version: 8,
22+
projection: {
23+
type: 'globe',
24+
},
25+
sources: {
26+
seamlessphoto: {
27+
type: 'raster',
28+
tiles: [
29+
'https://cyberjapandata.gsi.go.jp/xyz/seamlessphoto/{z}/{x}/{y}.jpg',
30+
],
31+
maxzoom: 18,
32+
tileSize: 256,
33+
attribution:
34+
'<a href="https://maps.gsi.go.jp/development/ichiran.html">地理院タイル</a>',
35+
},
36+
terrain: gsiTerrainSource,
37+
},
38+
layers: [
39+
{
40+
id: 'seamlessphoto',
41+
source: 'seamlessphoto',
42+
type: 'raster',
43+
},
44+
],
45+
terrain: {
46+
source: 'terrain',
47+
exaggeration: 1.2,
48+
},
49+
},
50+
});

0 commit comments

Comments
 (0)