forked from geops/openlayers-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
180 lines (164 loc) · 4.81 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
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
<html>
<head>
<title>OpenLayers Editor</title>
<link rel="stylesheet" type="text/css" href="style/style.css" />
<link
rel="stylesheet"
type="text/css"
href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io/en/v6.0.1/css/ol.css"
/>
<meta charset="utf-8" />
</head>
<body>
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io/en/v6.0.1/build/ol.js"></script>
<script src="https://unpkg.com/[email protected]/dist/jsts.min.js"></script>
<script src="build/index.js"></script>
<div id="app">
<div id="header">
<nav>
<div id="brand">OpenLayers Editor</div>
<a href="#" class="active">Demo</a>
<a href="api.html">API</a>
<a target="_blank" href="https:/geops/openlayers-editor">
Code
</a>
</nav>
</div>
<div id="map"></div>
<div id="promo">
<a href="http://geops.de/karriere" target="_blank">
<div id="promo-text">Join the team!</div>
</a>
</div>
<div id="copyrightDiv">
© OpenStreetMap contributors © Mapbox
</div>
</div>
<script type="text/javascript">
var editLayer = new ol.layer.Vector({
source: new ol.source.Vector({
wrapX: false
})
});
var projection = ol.proj.get("EPSG:3857");
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.WMTS({
url:
"https://api.mapbox.com/v4/geops.db9390ee/" +
"{TileMatrix}/{TileCol}/{TileRow}.png?access_token=" +
"pk.eyJ1IjoiZ2VvcHMiLCJhIjoiVnlkeXdzayJ9.aGtp4w0C-0vZZae1HneLGg",
requestEncoding: "REST",
crossOrigin: "anonymous",
layer: "0",
format: "image/png",
projection: projection,
tileGrid: new ol.tilegrid.WMTS({
origin: ol.extent.getTopLeft(projection.getExtent()),
resolutions: [
156543.03392811998,
78271.51696419998,
39135.758481959994,
19567.879241008,
9783.939620504,
4891.969810252,
2445.984905126,
1222.9924525644,
611.4962262807999,
305.74811314039994,
152.87405657047998,
76.43702828523999,
38.21851414248,
19.109257071295996,
9.554628535647998,
4.777314267823999,
2.3886571339119995,
1.1943285669559998,
0.5971642834779999,
0.29858214174039993
],
matrixIds: [
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19"
]
})
})
}),
editLayer
],
target: "map",
view: new ol.View({
center: [873708.375917, 6105425.847789],
zoom: 15
}),
wrapX: false
});
var editor = new ole.Editor(map);
var cad = new ole.control.CAD({
source: editLayer.getSource()
});
var draw = new ole.control.Draw({
source: editLayer.getSource()
});
var drawLine = new ole.control.Draw({
type: "LineString",
source: editLayer.getSource()
});
var rotate = new ole.control.Rotate({
source: editLayer.getSource()
});
var drawPoly = new ole.control.Draw({
type: "Polygon",
source: editLayer.getSource()
});
var modify = new ole.control.Modify({
source: editLayer.getSource()
});
var buffer = new ole.control.Buffer({
source: editLayer.getSource()
});
var union = new ole.control.Union({
source: editLayer.getSource()
});
var intersection = new ole.control.Intersection({
source: editLayer.getSource()
});
var difference = new ole.control.Difference({
source: editLayer.getSource()
});
editor.addControls([
cad,
draw,
drawLine,
drawPoly,
modify,
rotate,
buffer,
union,
intersection,
difference
]);
var ls = new ole.service.LocalStorage();
editor.addService(ls);
</script>
</body>
</html>