-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathwebgl-points.vue
More file actions
93 lines (86 loc) · 2.24 KB
/
webgl-points.vue
File metadata and controls
93 lines (86 loc) · 2.24 KB
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
<template>
<div id="map"></div>
</template>
<script>
import 'ol/ol.css';
import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import WebGLPointsLayer from 'ol/layer/WebGLPoints';
import GeoJSON from 'ol/format/GeoJSON';
import Vector from 'ol/source/Vector';
import OSM from 'ol/source/OSM';
export default {
data() {
return {
map: null,
}
},
mounted() {
this.map = new Map({
layers: [
new TileLayer({
source: new OSM()
})
],
target: document.getElementById('map'),
view: new View({
center: [0, 0],
zoom: 2
})
});
let vectorSource = new Vector({
url: 'http://localhost:8000/world-cities.geojson',
format: new GeoJSON()
});
let pointLayer = new WebGLPointsLayer({
source: vectorSource,
style: {
"symbol": {
"symbolType": "circle",
"size": [
"interpolate",
[
"linear"
],
[
"get",
"population"
],
40000,
8,
2000000,
28
],
"color": "#006688",
"rotateWithView": false,
"offset": [
0,
0
],
"opacity": [
"interpolate",
[
"linear"
],
[
"get",
"population"
],
40000,
0.6,
2000000,
0.92
]
}
}
});
this.map.addLayer(pointLayer);
}
}
</script>
<style>
#map {
height: 100%;
}
</style>