-
Notifications
You must be signed in to change notification settings - Fork 0
/
openlayers-intro.html
204 lines (160 loc) · 4.43 KB
/
openlayers-intro.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
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
<!DOCTYPE html>
<html>
<head>
<title>openlayers-intro</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/github.min.css">
<style>
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
html {
background: #ffffff;
color: black;
font-family: 'Droid Serif';
}
body {
margin-left: 10%;
width: 80%;
max-width: 680px;
}
html, body {
overflow-x: initial;
}
#htmlcontent {
padding-top: 1rem;
padding-bottom: 2rem;
}
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: normal;
margin-top: 2rem;
margin-bottom: 1rem;
color: #337ab7;
}
pre {
font-family: 'Ubuntu Mono';
}
blockquote {
border-left: 5px solid #ccc;
margin: 1.5em 10px;
padding: 0.5em 10px;
}
#mdcontent {
display: none;
}
img {
border-style: solid;
border-width: 2px;
color: #E25D33;
}
/*!
Pure v0.6.0
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
https://github.com/yahoo/pure/blob/master/LICENSE.md
*/
table {
/* Remove spacing between table cells (from Normalize.css) */
border-collapse: collapse;
border-spacing: 0;
empty-cells: show;
border: 1px solid #cbcbcb;
margin: 1em 0 1.5em 0;
}
table caption {
color: #000;
font: italic 85%/1 arial, sans-serif;
padding: 1em 0;
text-align: center;
}
table td, table th {
border-left: 1px solid #cbcbcb;
/* inner column border */
border-width: 0 0 0 1px;
font-size: inherit;
margin: 0;
overflow: visible;
/*to make ths where the title is really long work*/
padding: 0.5em 1em;
/* cell padding */
}
/* Consider removing this next declaration block, as it causes problems when
there's a rowspan on the first cell. Case added to the tests. issue#432 */
table td:first-child, table th:first-child {
border-left-width: 0;
}
table thead {
background-color: #e0e0e0;
color: #000;
text-align: left;
vertical-align: bottom;
}
/*
striping:
even - #fff (white)
odd - #f2f2f2 (light gray)
*/
/* nth-child selector for modern browsers */
table tr:nth-child(2n-2) td {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<div id="mdcontent">
# Introduksjon til Open Layers
## Sentrale Open Layers-komponenter (Javascript-objekter)
Koden nedenfor er fra [Basic Concepts](http://openlayers.org/en/latest/doc/tutorials/concepts.html)-siden hos Open Layers. Der kan du lese om oppgaven/funksjonen til dem. Dette er viktig lesning - kortfattet og konsist!
### Map
```HTML,XML
<div id="map" style="width: 100%, height: 400px">
</div>
<script>
var map = new ol.Map({target: 'map'});
</script>
```
### View
```javascript
map.setView(new ol.View({
center: [0, 0],
zoom: 2
}));
```
### Source
```javascript
var osmSource = new ol.source.OSM();
```
### Layer
- ```ol.layer.Tile``` is for layer sources that provide pre-rendered, tiled images in grids that are organized by zoom levels for specific resolutions.
- ```ol.layer.Image``` is for server rendered images that are available for arbitrary extents and resolutions.
- ```ol.layer.Vector``` is for vector data that is rendered client-side.
```javascript
var osmLayer = new ol.layer.Tile({source: osmSource});
map.addLayer(osmLayer);
```
### Komplett eksempel
[basic-concepts.html](./docs/openlayers/basic-concepts.html)
</div>
<div id="htmlcontent">
<!-- generated html -->
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/8.0.1/markdown-it.min.js">
</script>
<script type="text/javascript" src="script/markdown-it-link-target.min.js">
</script>
<script>
var md = markdownit();
md.use(markdownitLinkTarget);
var markdown = document.getElementById('mdcontent');
document.getElementById("htmlcontent").innerHTML = md.render(markdown.innerHTML);
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.7.0/highlight.min.js">
</script>
<script>
hljs.initHighlightingOnLoad();
</script>
</body>
</html>