-
Notifications
You must be signed in to change notification settings - Fork 2
/
api-via-javascript-add-textlayer.html
77 lines (72 loc) · 2.34 KB
/
api-via-javascript-add-textlayer.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
<!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 - Toevoegen TextLayer met locaties, popup en marker</title>
<link rel="stylesheet" href="./styles/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="stylesheet" href="api-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;
}
.olImageLoadError {
background-color: transparent; /* may likely be omitted */
opacity: 0.0;
filter: alpha(opacity=0); /* IE */
visibility: hidden;
}
</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({
txturl: "./data/textfile.txt",
layer: "natura2000",
ls: true
});
//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([150000,455000]);
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>