-
Notifications
You must be signed in to change notification settings - Fork 293
/
view_2d_map.html
75 lines (64 loc) · 2.82 KB
/
view_2d_map.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
74
75
<html>
<head>
<title>Itowns - Orthographic Camera Example</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/example.css">
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="viewerDiv"></div>
<script src="../dist/itowns.js"></script>
<script src="js/GUI/LoadingScreen.js"></script>
<script type="text/javascript">
// # Orthographic viewer
// Define geographic extent: CRS, min/max X, min/max Y
var extent = new itowns.Extent(
'EPSG:3857',
-20026376.39, 20026376.39,
-20048966.10, 20048966.10);
// `viewerDiv` will contain iTowns' rendering area (`<canvas>`)
var viewerDiv = document.getElementById('viewerDiv');
// Instanciate PlanarView
// By default itowns' tiles geometry have a "skirt" (ie they have a height),
// but in case of orthographic we don't need this feature, so disable it
var view = new itowns.PlanarView(viewerDiv, extent, { disableSkirt: true, maxSubdivisionLevel: 10, placement: { tilt: 90 } });
// eslint-disable-next-line no-new
new itowns.PlanarControls(view, {
// We do not want the user to zoom out too much
maxAltitude: 40000000,
// We want to keep the rotation disabled, to only have a view from the top
enableRotation: false,
// Faster zoom in/out speed
zoomInFactor: 0.5,
zoomOutFactor: 0.5,
// Don't zoom too much on smart zoom
smartZoomHeightMax: 100000,
});
setupLoadingScreen(viewerDiv, view);
// Add a TMS imagery source
var opensmSource = new itowns.TMSSource({
isInverted: true,
// eslint-disable-next-line no-template-curly-in-string
url: 'http://c.tile.stamen.com/watercolor/${z}/${x}/${y}.jpg',
networkOptions: { crossOrigin: 'anonymous' },
extent,
projection: 'EPSG:3857',
attribution: {
name: 'OpenStreetMap',
url: 'http://www.openstreetmap.org/',
},
});
// Add a TMS imagery layer
var opensmLayer = new itowns.ColorLayer('OPENSM', {
updateStrategy: {
type: itowns.STRATEGY_DICHOTOMY,
},
source: opensmSource,
});
view.addLayer(opensmLayer);
// Request redraw
view.notifyChange();
</script>
</body>
</html>