-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
99 lines (99 loc) · 2.96 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
95
96
97
98
99
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.5.0/css/ol.css" type="text/css">
<style>
.map {
height: 400px;
width: 100%;
}
</style>
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.5.0/build/ol.js"></script>
<title>Programming Process Exercise</title>
</head>
<body>
<h2>Map of where folks are</h2>
<div id="map" class="map"></div>
<script type="text/javascript">
var places = [[-13431765.23, 4202379.26], 3, [-13412106.21, 4481313.70], 2, [-13585018.77, 4490638.18], 1, [-13568320.85, 4486352.93], 1, [-13576792.26, 4472025.43], 1]
var orangeFeatures = []
var yellowFeatures = []
var purpleFeatures = []
for(i=0; i<10; i+=2){
if(places[i+1] == 1){
yellowFeatures.push(new ol.Feature({
geometry: new ol.geom.Point(places[i])
}));
}
else if(places[i+1] == 2){
orangeFeatures.push(new ol.Feature({
geometry: new ol.geom.Point(places[i])
}));
}
else{
console.log("purple");
purpleFeatures.push(new ol.Feature({
geometry: new ol.geom.Point(places[i])
}));
}
}
var yellowVectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: yellowFeatures,
}),
style: new ol.style.Style({
image: new ol.style.Circle({
radius: 3,
fill: new ol.style.Fill({color: 'yellow'}),
stroke: new ol.style.Stroke({
color: 'black',
width: 1})
})
})
});
var orangeVectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: orangeFeatures,
}),
style: new ol.style.Style({
image: new ol.style.Circle({
radius: 6,
fill: new ol.style.Fill({color: 'orange'}),
stroke: new ol.style.Stroke({
color: 'black',
width: 1})
})
})
});
var purpleVectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: purpleFeatures,
}),
style: new ol.style.Style({
image: new ol.style.Circle({
radius: 9,
fill: new ol.style.Fill({color: 'purple'}),
stroke: new ol.style.Stroke({
color: 'black',
width: 1})
})
})
});
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
yellowVectorLayer,
purpleVectorLayer,
orangeVectorLayer
],
view: new ol.View({
center: ol.proj.fromLonLat([-120.6625, 35.3050]),
zoom: 6
})
});
</script>
</body>
</html>