-
Notifications
You must be signed in to change notification settings - Fork 5
/
lecture10_Mod02_b_01_a.md.html
214 lines (214 loc) · 16.2 KB
/
lecture10_Mod02_b_01_a.md.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
205
206
207
208
209
210
211
212
213
214
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<meta name="author" content="Karl Benedict" />
<title>Geography 485L/585L - Internet Mapping</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<style type="text/css">
a.sourceLine { display: inline-block; line-height: 1.25; }
a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
a.sourceLine:empty { height: 1.2em; position: absolute; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
a.sourceLine { text-indent: -1em; padding-left: 1em; }
}
pre.numberSource a.sourceLine
{ position: relative; }
pre.numberSource a.sourceLine:empty
{ position: absolute; }
pre.numberSource a.sourceLine::before
{ content: attr(data-line-number);
position: absolute; left: -5em; text-align: right; vertical-align: baseline;
border: none; pointer-events: all;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
a.sourceLine::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="page.css">
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<h1 class="title">Geography 485L/585L - Internet Mapping</h1>
<p class="author">Karl Benedict</p>
<p class="date">Spring 2018</p>
</header>
<!---------------------------------------------------------------------------->
<!-- Week 10 ----------------------------------------------------------------->
<!-- Lecture 02 b 01 a ------------------------------------------------------->
<!-- Web-based Mapping Clients------------------------------------------------>
<!-- OpenLayers Javascript Framework------------------------------------------>
<!---------------------------------------------------------------------------->
<h1 id="week-10---module-2b---openlayers-4-javascript-framework">Week 10 - Module 2b - OpenLayers 4 Javascript Framework</h1>
<h3 id="overview" class="module02b01a">Overview</h3>
<ul>
<li><p>Capabilities</p></li>
<li><p>OpenLayers = Javascript (by example)</p></li>
</ul>
<h3 id="openlayers-capabilities" class="module02b01a">OpenLayers Capabilities</h3>
<ul>
<li>Support for Multiple basemaps: <em>BingMaps</em>, <em>OpenStreetMap</em>, <em>Stamen</em></li>
<li>Model for interaction with multiple map server platforms: <em>ArcGIS</em> (REST), <em>MapServer</em>, <em>GeoServer</em></li>
<li>Support for key OGC standards: <em>WMS</em>, <em>WMTS</em>, <em>WFS</em>, <em>GML</em>, <em>KML</em></li>
<li>Multiple control types: <em>Attribution</em>, <em>Zoom</em>, <em>Overview</em>, <em>Scale</em>, <em>FullScreen</em>, <em>Graticule</em></li>
<li>Custom styled features with associated attributes: <em>Curve</em>, <em>LinearRing</em>, <em>LineString</em>, <em>MultiLineString</em>, <em>MultiPoint</em>, <em>MultiPolygon</em>, <em>Point</em>, <em>Polygon</em></li>
<li>Support for many formats for data read and write: <em>ATOM</em>, <em>GML</em> (1, 2, 3), <em>GeoJSON</em>, <em>GPX</em>, <em>KML</em>, <em>WKT</em>, any many others</li>
<li>Open Source, enabling modification and integration into other systems (e.g. <a href="http://geoext.org/">GeoExt</a>)</li>
</ul>
<h3 id="distinguishing-characteristics-between-openlayers-and-google-maps" class="module02b01a">Distinguishing Characteristics Between OpenLayers and Google Maps</h3>
<ul>
<li>Greater emphasis on client-side processing - Client access and rendering of data files that Google’s servers otherwise take care of (pros & cons to this approach)</li>
<li>Integrated support for OGC services and their products</li>
<li>Support for different projections (adds complexity)</li>
<li>API more rich in options ==> more complexity</li>
</ul>
<h3 id="resources" class="module02b01a">Resources</h3>
<p><a href="http://openlayers.org/">OpenLayers Home Page</a></p>
<p><a href="http://openlayers.org/en/latest/apidoc/">Application Programming Interface (API) Reference</a></p>
<p><a href="http://openlayers.org/en/latest/examples/">Examples</a></p>
<h3 id="demonstrations-and-examples" class="module02b01a">Demonstrations and Examples</h3>
<div class="codeTable">
<p>OpenLayers_01.html</p>
<div class="sourceCode" id="OpenLayers_01_demo"><pre class="sourceCode numberSource html numberLines"><code class="sourceCode html"><a class="sourceLine" id="OpenLayers_01_demo-1" data-line-number="1"><span class="kw"><html></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-2" data-line-number="2"></a>
<a class="sourceLine" id="OpenLayers_01_demo-3" data-line-number="3"><span class="kw"><head></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-4" data-line-number="4"> <span class="kw"><link</span><span class="ot"> rel=</span><span class="st">"stylesheet"</span><span class="ot"> href=</span><span class="st">"css/OpenLayers_01.css"</span><span class="ot"> type=</span><span class="st">"text/css"</span><span class="kw">></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-5" data-line-number="5"> </a>
<a class="sourceLine" id="OpenLayers_01_demo-6" data-line-number="6"> <span class="co"><!-- these two files are imported from a host that provides a hosted full </span></a>
<a class="sourceLine" id="OpenLayers_01_demo-7" data-line-number="7"><span class="co"> build of the OpenLayers package for development as documented here: </span></a>
<a class="sourceLine" id="OpenLayers_01_demo-8" data-line-number="8"><span class="co"> https://openlayers.org/download/ --></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-9" data-line-number="9"> <span class="kw"><link</span> </a>
<a class="sourceLine" id="OpenLayers_01_demo-10" data-line-number="10"><span class="ot"> rel=</span><span class="st">"stylesheet"</span> </a>
<a class="sourceLine" id="OpenLayers_01_demo-11" data-line-number="11"><span class="ot"> href=</span><span class="st">"https://cdnjs.cloudflare.com/ajax/libs/openlayers/4.6.4/ol.css"</span> </a>
<a class="sourceLine" id="OpenLayers_01_demo-12" data-line-number="12"><span class="ot"> type=</span><span class="st">"text/css"</span><span class="kw">></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-13" data-line-number="13"> <span class="kw"><script</span> </a>
<a class="sourceLine" id="OpenLayers_01_demo-14" data-line-number="14"><span class="ot"> src=</span><span class="st">"https://cdnjs.cloudflare.com/ajax/libs/openlayers/4.6.4/ol.js"</span> </a>
<a class="sourceLine" id="OpenLayers_01_demo-15" data-line-number="15"><span class="ot"> type=</span><span class="st">"text/javascript"</span><span class="kw">></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-16" data-line-number="16"> <span class="kw"></script></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-17" data-line-number="17"><span class="kw"></head></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-18" data-line-number="18"></a>
<a class="sourceLine" id="OpenLayers_01_demo-19" data-line-number="19"><span class="kw"><body></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-20" data-line-number="20"> <span class="kw"><h1></span>This is a very simple OpenLayers 4 sample map page<span class="kw"></h1></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-21" data-line-number="21"></a>
<a class="sourceLine" id="OpenLayers_01_demo-22" data-line-number="22"> <span class="kw"><div</span><span class="ot"> id=</span><span class="st">'map'</span><span class="kw">></span><span class="co"><!-- This is where the map will be displayed --></span><span class="kw"></div></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-23" data-line-number="23"></a>
<a class="sourceLine" id="OpenLayers_01_demo-24" data-line-number="24"> <span class="co"><!-- import the external Javascript file with the map configuration code --></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-25" data-line-number="25"> <span class="kw"><script</span><span class="ot"> src=</span><span class="st">"js/OpenLayers_01.js"</span><span class="ot"> type=</span><span class="st">"text/javascript"</span><span class="kw">></script></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-26" data-line-number="26"><span class="kw"></body></span></a>
<a class="sourceLine" id="OpenLayers_01_demo-27" data-line-number="27"></a>
<a class="sourceLine" id="OpenLayers_01_demo-28" data-line-number="28"><span class="kw"></html></span></a></code></pre></div>
<p>OpenLayers_01.js</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode numberSource html numberLines"><code class="sourceCode html"><a class="sourceLine" id="cb1-1" data-line-number="1">// OpenLayers_01.js</a>
<a class="sourceLine" id="cb1-2" data-line-number="2"></a>
<a class="sourceLine" id="cb1-3" data-line-number="3">var myMap = new ol.Map({</a>
<a class="sourceLine" id="cb1-4" data-line-number="4"> target: 'map',</a>
<a class="sourceLine" id="cb1-5" data-line-number="5"> layers: [</a>
<a class="sourceLine" id="cb1-6" data-line-number="6"> new ol.layer.Tile({</a>
<a class="sourceLine" id="cb1-7" data-line-number="7"> source: new ol.source.OSM()</a>
<a class="sourceLine" id="cb1-8" data-line-number="8"> })</a>
<a class="sourceLine" id="cb1-9" data-line-number="9"> ],</a>
<a class="sourceLine" id="cb1-10" data-line-number="10"> view: new ol.View({</a>
<a class="sourceLine" id="cb1-11" data-line-number="11"> center: ol.proj.fromLonLat([-106.624083,35.08427]),</a>
<a class="sourceLine" id="cb1-12" data-line-number="12"> zoom: 18</a>
<a class="sourceLine" id="cb1-13" data-line-number="13"> })</a>
<a class="sourceLine" id="cb1-14" data-line-number="14"> });</a></code></pre></div>
<p>OpenLayers_01.css</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode numberSource html numberLines"><code class="sourceCode html"><a class="sourceLine" id="cb2-1" data-line-number="1">/* OpenLayers_01.css */</a>
<a class="sourceLine" id="cb2-2" data-line-number="2"></a>
<a class="sourceLine" id="cb2-3" data-line-number="3">body {</a>
<a class="sourceLine" id="cb2-4" data-line-number="4"> width:100%;</a>
<a class="sourceLine" id="cb2-5" data-line-number="5"> height:100%</a>
<a class="sourceLine" id="cb2-6" data-line-number="6">}</a>
<a class="sourceLine" id="cb2-7" data-line-number="7"></a>
<a class="sourceLine" id="cb2-8" data-line-number="8">#map,.map {</a>
<a class="sourceLine" id="cb2-9" data-line-number="9"> width:600px;</a>
<a class="sourceLine" id="cb2-10" data-line-number="10"> height:400px;</a>
<a class="sourceLine" id="cb2-11" data-line-number="11">}</a>
<a class="sourceLine" id="cb2-12" data-line-number="12"></a>
<a class="sourceLine" id="cb2-13" data-line-number="13">#map_selector li {</a>
<a class="sourceLine" id="cb2-14" data-line-number="14"> cursor:pointer;</a>
<a class="sourceLine" id="cb2-15" data-line-number="15"> width:350px;</a>
<a class="sourceLine" id="cb2-16" data-line-number="16">}</a>
<a class="sourceLine" id="cb2-17" data-line-number="17"></a>
<a class="sourceLine" id="cb2-18" data-line-number="18">#map_selector li:hover {</a>
<a class="sourceLine" id="cb2-19" data-line-number="19"> background-color: yellow;</a>
<a class="sourceLine" id="cb2-20" data-line-number="20">}</a>
<a class="sourceLine" id="cb2-21" data-line-number="21"></a>
<a class="sourceLine" id="cb2-22" data-line-number="22"></a>
<a class="sourceLine" id="cb2-23" data-line-number="23"></a>
<a class="sourceLine" id="cb2-24" data-line-number="24">#map div.ol-viewport div.ol-overlaycontainer-stopevent </a>
<a class="sourceLine" id="cb2-25" data-line-number="25">div.ol-overviewmap.ol-unselectable.ol-control.ol-uncollapsible {</a>
<a class="sourceLine" id="cb2-26" data-line-number="26"> top: 200px;</a>
<a class="sourceLine" id="cb2-27" data-line-number="27"> bottom: 300px;</a>
<a class="sourceLine" id="cb2-28" data-line-number="28">}</a></code></pre></div>
</div>
<h3 id="demonstration-and-examples---online-resources" class="module02b01a">Demonstration and Examples - Online Resources</h3>
<ul>
<li><a href="http://karlbenedict.com/GEOG485-585/sample-files/OpenLayers/OpenLayers_01.html">Basic Mapper</a> (with Open Street Map base map (<a href="https://github.com/karlbenedict/GEOG485-585/blob/master/sample-files/OpenLayers/OpenLayers_01.html">source</a>))</li>
<li><a href="http://karlbenedict.com/GEOG485-585/sample-files/OpenLayers/OpenLayers_02_basemaps.html">Mapper</a> (<a href="https://github.com/karlbenedict/GEOG485-585/blob/master/sample-files/OpenLayers/OpenLayers_02_basemaps.html">source</a>) with a variety of base maps (Bing, Stamen, OSM) and basic layer selection</li>
<li>Basic Mapper with Controls: <a href="http://karlbenedict.com/GEOG485-585/sample-files/OpenLayers/OpenLayers_01_noControls.html">No Controls</a> (<a href="https://github.com/karlbenedict/GEOG485-585/blob/master/sample-files/OpenLayers/OpenLayers_01_noControls.html">source</a>), <a href="http://karlbenedict.com/GEOG485-585/sample-files/OpenLayers/OpenLayers_01_controlArray.html">Customized Controls</a> (<a href="https://github.com/karlbenedict/GEOG485-585/blob/master/sample-files/OpenLayers/OpenLayers_01_controlArray.html">source</a>)</li>
</ul>
<h2 id="next-week---custom-features-and-wms-layers" class="module02b01a">Next Week - Custom Features and WMS Layers</h2>
<hr />
<section>
<div class="license">
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work by <span data-xmlns:cc="http://creativecommons.org/ns#" data-property="cc:attributionName">Karl Benedict</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
</div>
</section>
</body>
</html>