-
Notifications
You must be signed in to change notification settings - Fork 2
/
27_Control.html
69 lines (62 loc) · 1.51 KB
/
27_Control.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
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="css/ol.css" type="text/css"/>
<link rel="stylesheet" href="css/sample.css" type="text/css"/>
<style>
body {
padding : 0;
margin : 0;
}
</style>
<title>OpenLayers 3 example 27 Control</title>
</head>
<body>
<div id="map" class="map"></div>
<script src="js/ol-debug.js"></script>
<script type="text/javascript">
var mousePosition = new ol.control.MousePosition({
// coordinateFormat: ol.coordinate.createStringXY(2),
coordinateFormat: ol.coordinate.toStringHDMS,
projection: 'EPSG:4326',
undefinedHTML: 'Outside'
});
var scaleLine = new ol.control.ScaleLine({
minWidth: 100,
units: /** @type {olx.control.AttributionOptions} */ 'nautical'
});
var zoomSlider = new ol.control.ZoomSlider();
var zoomToExtent = new ol.control.ZoomToExtent({
extent: ol.proj.transformExtent([120, 20, 150, 50], 'EPSG:4326', 'EPSG:3857')
});
var overviewMap = new ol.control.OverviewMap();
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
view: new ol.View({
center: ol.proj.transform([39.816667, 21.416667], 'EPSG:4326', 'EPSG:3857'),
zoom: 4
}),
controls: ol.control.defaults({
zoom: true,
attribution: true,
attributionOptions: /** @type {ol.control.ScaleLineUnits} */ ({
collapsible: false
}),
rotate: true
}).extend([
new ol.control.FullScreen(),
mousePosition,
scaleLine,
zoomSlider,
zoomToExtent,
overviewMap
])
});
</script>
</body>
</html>