-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
94 lines (91 loc) · 3.68 KB
/
index.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
<!doctype html>
<head>
<title>View Markers/Icons on OpenLayers</title>
<meta charset="utf-8">
<script src="js/linkparam.js"></script>
<link type="text/css" href="css/font-awesome.min.css" rel="stylesheet" />
<style type="text/css">
body {font-family:verdana, sans-serif;}
button {background-color:#42c5f4}
</style>
</head>
<body bgcolor="#f2f2f2">
<h3>Display Markers with Geolocation and Popup with OpenLayers</h3>
<p>This is an example consists of two files.
<ul>
<li>
<tt>index.html</tt> (this file)
</li>
<li>
<tt><a href="startbutton.html">startbutton.html</a></tt> uses the same marker data as index but shows just the start button.
</li>
<li>
<tt><a href="startbutton.html">viewicons.html</a> (loads the icon with default icon data)</tt>
</li>
</ul>
This file <tt>index.html</tt> calls <tt>viewicons.html</tt> lets the user select a geolocation and <tt>selectlocation.html</tt>
returns the selected geolocation back to index.html if the user clicks on a the Map.
Press submit button "Select Geolocation" and look at your browser location (<a href="https://github.com/niebert/openlayer_selectlocation/archive/master.zip" target="_blank">Download Demo</a>).
<hr>
<!-- next DIV element implements the main CallBack Structure -->
<div style="margins:30px">
<b>Call <i>viewicons.html</i> with a HTML form:</b>
<form id="mapviewer" action="viewicons.html" method="GET">
<!-- Callback URL: <input type="string" name="callback" value="index.html"> -->
<button type="submit">
<i class="fa fa-globe" aria-hidden="true"></i> View Icons on Map
</button>
<hr>
<b>Map Center:</b><input type="string" name="mapcenter" id="mymapcenter" size="80" value="-1.81185, 52.443141">
<b>Zoom:</b> <input type="string" name="zoom" id="myzoom" size="3" value="6">
<hr/>
<b>JSON Data for Icons:</b> <br/>
<textarea rows="12" style="width:100%;" name="jsondata" id="myjsondata">[
{
"geolocation": [
-0.14467470703124907,
51.493889053694915
],
"name": "The City of London <a href=\"https://en.wikipedia.org/wiki/London\" target=\"_blank\">Link to Wikipedia</a>"
},
{
"geolocation": [
-1.81185,
51.243141
],
"name": "Wikipedia Link to <a href=\"https://en.wikipedia.org/wiki/Birmingham\" target=\"_blank\">Birmingham</a>"
}
]
</textarea>
</form>
</div>
<!-- The following script reads link parameters and sets the parameters if "viewicons.html" return one -->
<script>
function el(id) {
return document.getElementById(id);
};
//---- Evaluate Link Paramaters ----
var vLinkParam = new LinkParam();
vLinkParam.init(document);
// load geoloaction from LinkParameter if available
if (vLinkParam.exists("mapcenter")) {
// Callback performed with LinkParameter mapcenter
// e.g. index.html?geolocation=-12.213,65.123
el("mymapcenter").value = vLinkParam.getValue("mapcenter");
};
if (vLinkParam.exists("zoom")) {
// Callback performed with LinkParameter zoom
// e.g. index.html?zoom=12
el("myzoom").value = vLinkParam.getValue("zoom");
};
if (vLinkParam.exists("jsondata")) {
// Callback performed with LinkParameter jsondata
// e.g. index.html?zoom=12
el("myjsondata").value = vLinkParam.getValue("jsondata");
};
</script>
<hr>
<b>GitHub:</b> View <a href="https://github.com/niebert/openlayer_display_markers" target="_blank">repository on GitHub</a>
<hr>
</body>
</html>