-
Notifications
You must be signed in to change notification settings - Fork 2
/
api-via-javascript-add-wms.html
73 lines (68 loc) · 2.48 KB
/
api-via-javascript-add-wms.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
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<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">
<title>Lusc API via JavaScript - Lagen (voorgedefinieerd plus WMS) en marker toevoegen via API parameters, inzoomen naar locatie via JavaScript functies</title>
<link rel="stylesheet" href="./styles/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<style type="text/css">
html {
width: 100%;
height: 100%;
font-family: 'Lucida Grande', Verdana, Geneva, Lucida, Arial, Helvetica, sans-serif;
}
body {
width: 100%;
height: 100%;
margin: 0px;
}
#map {
width: 100%;
height: 100%;
}
.olControlAttribution {
bottom: 3px!important;
background-color: #eee;
}
</style>
<script src="./OpenLayers.js"></script>
<script src="./javascripts/proj4js-compressed.js"></script>
<script src="lusc-api.js"></script>
<script>
var api = null;
function init() {
api = new Lusc.Api({
layer: 'NOK2011',
wmsurl: 'http://geodata.nationaalgeoregister.nl/vin/wms',
wmslayers: 'bevaarbaarheid',
mloc: [155792,576594],
titel: 'Bevaarbaarheid',
tekst: 'Legenda:<BR><img src="http://geodata.nationaalgeoregister.nl/vin/wms?TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=bevaarbaarheid&FORMAT=image%2Fgif">'
});
//Beschikbare kaartlagen: alert(api.getLayers());
//Het pad naar de markertypes: alert(api.getMarkerPath());
//Beschikbare markertypes: alert(api.getMarkers());
//Pan naar een andere locatie: api.setLocation([100000,400000]);
//Zoom naar een ander zoomnivo: api.setZoomLevel(3);
//Op basis van de locatie van de client inzoomen op de kaart
//navigator.geolocation.getCurrentPosition(showLocation);
api.setLocation([155792,576594]);
api.setZoomLevel(7)
}
function showLocation(position){
var lat = position.coords.latitude;
var lon = position.coords.longitude;
pointRD = api.reprojectWGS84toRD(lat,lon);
X = pointRD.lon;
Y = pointRD.lat;
//alert("X:" + parseInt(X));
//alert("Y:"+ parseInt(Y));
api.setLocation([parseInt(X),parseInt(Y)]);
}
</script>
</head>
<body onload="init();">
<div id="map"></div>
</body>
</html>