-
Notifications
You must be signed in to change notification settings - Fork 2
/
openlayers.html
65 lines (65 loc) · 2.34 KB
/
openlayers.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
<!DOCTYPE html>
<html>
<head>
<title>swissimage</title>
<meta http-equiv="imagetoolbar" content="no"/>
<meta http-equiv="imagetoolbar" content="no"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<style type="text/css">
html, body { margin:0; padding: 0; height: 100%; width: 100%; }
body { width:100%; height:100%; background: #ffffff; }
#map { position: absolute; height: 100%; width: 100%; }
#map { background-color: #FFFFFF; }
.olImageLoadError { display: none !important; }
.olControlAttribution { bottom: 0px !important; left: 2px; right: inherit; width: 400px; }
/* conditionally position control differently for Google Maps */
.olForeignContainer div.olControlMousePosition { bottom: 28px; }
</style>
<script src="http://maps.google.com/maps/api/js?v=3&sensor=false"></script>
<script src="http://openlayers.org/api/2.13/OpenLayers.js" type="text/javascript"></script>
<script type="text/javascript">
var map, layer;
var mapBounds = new OpenLayers.Bounds(9.539910, 46.929649, 9.656996, 46.985765);var mapMinZoom = 11;
var mapMaxZoom = 16;
function init() {
var options = {
projection: "EPSG:3857",
displayProjection: "EPSG:4326",
numZoomLevels: 18
};
map = new OpenLayers.Map('map', options);
layer = new OpenLayers.Layer.XYZ("MapTiler layer", "${z}/${x}/${y}.jpg", {
transitionEffect: 'resize',
isBaseLayer: true
});
var osm = new OpenLayers.Layer.OSM();
var gmap = new OpenLayers.Layer.Google(
"Google Streets", {numZoomLevels: 20}
);
var ghyb = new OpenLayers.Layer.Google(
"Google Hybrid",
{type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20}
);
var gsat = new OpenLayers.Layer.Google(
"Google Satellite",
{type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 22}
);
var gphy = new OpenLayers.Layer.Google(
"Google Physical",
{type: google.maps.MapTypeId.TERRAIN}
);
map.addLayers([
layer, osm, gmap, gsat, ghyb, gphy
]);
map.zoomToExtent(mapBounds.transform(map.displayProjection, map.projection ));
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.Permalink());
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
</script>
</head>
<body onload="init();">
<div id="map"></div>
</body>
</html>