-
Notifications
You must be signed in to change notification settings - Fork 0
/
openlayers.html
65 lines (61 loc) · 2.84 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>NLS Map + OpenLayers 3</title>
<style type="text/css">
html, body { font-family: 'Lucida Grande',Geneva,Arial,Verdana,sans-serif; }
body { margin: 10px; background: #fff; }
#map { background-color: #cedfe4; border: 1px solid gray; width: 600px; height: 400px; position: relative;}
</style>
<script type="text/javascript" src="http://nls.tileserver.com/api.js"></script>
<script src="http://openlayers.org/en/v3.0.0/build/ol.js" type="text/javascript"></script>
<link rel="stylesheet" href="http://openlayers.org/en/v3.0.0/css/ol.css" type="text/css">
<script type="text/javascript">
var map, layer;
function init() {
var extent = ol.proj.transformExtent([-9.257287, 49.849456, 2.127704, 60.89107],
'EPSG:4326', 'EPSG:3857');
var center = ol.proj.transformExtent([-3.564791, 55.370263],
'EPSG:4326', 'EPSG:3857');
var NLS_API_ATTRIBUTION = new ol.Attribution({
html: 'Historical Maps Layer, 1919-1947 from the <a href="http://maps.nls.uk/projects/api/">NLS Maps API</a>'
});
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.XYZ({
attributions: [NLS_API_ATTRIBUTION],
tileUrlFunction: function(src) {
return NLSTileUrlOS(src[1], src[2], src[0]);
},
extent: extent,
minZoom: 1,
maxZoom: 14,
tilePixelRatio: 1
})
})
],
renderer: 'canvas',
target: 'map',
view: new ol.View({
projection: 'EPSG:3857',
center: center,
zoom: 1
})
});
map.getView().fitExtent(extent, map.getSize());
}
</script>
</head>
<body onload="init()">
<h1>NLS Map + OpenLayers</h1>
<p><a href="http://www.nls.uk/">National Library of Scotland</a> & <a href="http://www.klokantech.com/">Klokan Technologies GmbH</a></p>
<p>Historical maps from 1919-47 <a href="http://geo.nls.uk/maps/api/">NLS Maps API</a></p>
<div id="map">
<a href="http://www.nls.uk/" target="_blank" id="nlslogo" style="-webkit-user-select:none; display:block;position:absolute;bottom:20px;left:2px;z-index:1000;" name="nlslogo">
<img src="nls70-nq8.png" width="70" height="41" border="0" alt="National Library of Scotland" /></a>
<a href="http://www.klokantech.com/" target="_blank" id="klokantechlogo" style="-webkit-user-select: none; display:block;position:absolute;bottom:2px;left:2px;z-index:1000;background:rgba(255, 255, 255, 0.6); padding: 2px;" name="klokantechlogo">
<img src="klokantech70-nq8.png" width="70" height="11" border="0" alt="KlokanTech.com" /></a>
</div>
</body>
</html>