-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
219 lines (174 loc) · 6.01 KB
/
index.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<link rel="stylesheet" href="styl_leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="proj4-compressed.js"></script>
<script src="http://kartena.github.io/Proj4Leaflet/src/proj4leaflet.js"></script>
<script>
/*
* L.SingleTile uses L.ImageOverlay to display a single-tile WMS layer.
* url parameter must accept WMS-style width, height and bbox.
*/
L.SingleTile = L.ImageOverlay.extend({
defaultWmsParams: {
service: 'WMS',
request: 'GetMap',
version: '1.1.1',
styles: '',
srs: "EPSG:4326",
layers: 'rubbish:papier_3857',
format: 'image/png',
transparent: true
},
initialize: function( url, options ) {
this.wmsParams = L.extend({}, this.defaultWmsParams);
this.wmsParams = L.extend(this.wmsParams, options);
L.ImageOverlay.prototype.initialize.call(this, url, null, options);
},
setParams: function (params) {
L.extend(this.wmsParams, params);
return this;
},
redraw: function () {
this._updateImageUrl();
},
onAdd: function (map) {
var projectionKey = parseFloat(this.wmsParams.version) >= 1.3 ? 'crs' : 'srs';
this.wmsParams[projectionKey] = 'EPSG:4326'; // this is incorrect!
//this.wmsParams[projectionKey] = map.options.crs.code;
L.ImageOverlay.prototype.onAdd.call(this, map);
map.on('moveend', this._updateImageUrl, this);
},
onRemove: function (map) {
map.on('moveend', this._updateImageUrl, this);
L.ImageOverlay.prototype.onRemove.call(this, map);
},
// Copypasted from L.ImageOverlay (dirty hack)
_initImage: function () {
this._image = L.DomUtil.create('img', 'leaflet-image-layer');
if (this._map.options.zoomAnimation && L.Browser.any3d) {
L.DomUtil.addClass(this._image, 'leaflet-zoom-animated');
} else {
L.DomUtil.addClass(this._image, 'leaflet-zoom-hide');
}
this._updateOpacity();
this._bounds = this._map.getBounds();
//TODO createImage util method to remove duplication
L.extend(this._image, {
galleryimg: 'no',
onselectstart: L.Util.falseFn,
onmousemove: L.Util.falseFn,
onload: L.bind(this._onImageLoad, this),
src: this._constructUrl()
});
},
_onImageLoad: function () {
this._bounds = this._map.getBounds();
this._reset();
this.fire('load');
},
_updateImageUrl: function () {
this._image.src = this._constructUrl();
},
_constructUrl: function () {
var size = this._map.getSize();
var b = this._map.getBounds();
return this._url + L.Util.getParamString(this.wmsParams, this._url) + "&width=" + size.x + "&height=" + size.y + "&bbox=" + b.toBBoxString();
}
});
L.singleTile = function (url, options) {
return new L.SingleTile(url, options);
};
</script>
<body style="height: 95%">
<div id="mapid" style="width: 100%; height: 100%"></div>
<script>
var layerswitcher = null;
proj4.defs("EPSG:3857","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs");
// set up the map
map = new L.Map('mapid');
// create the tile layer with correct attribution
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
var osm = new L.TileLayer(osmUrl, {minZoom: 3, maxZoom: 18, attribution: osmAttrib});
// start the map in South-East England
map.setView(new L.LatLng(48.20, 20),7);
var states_layer = L.Proj.geoJson([], {
"style": function(feature) {
return {"fillOpacity": 0, "color": "black", "opacity": 1, "weight": 2 };
}
}
).addTo(map);
var landuse_sk = L.tileLayer.wms('http://data.datacove.eu:8080/geoserver/gwc/service/wms?', {
layers: 'lu:lu_elu_object_sk',
format: 'image/png',
transparent: true,
attribution: "Slovakia Land Use"
});
var landuse_hu = L.tileLayer.wms('http://data.datacove.eu:8080/geoserver/gwc/service/wms?', {
layers: 'lu:lu_elu_object_hu',
format: 'image/png',
transparent: true,
attribution: "Hungary Land Use"
});
var lucas_point_sk = L.tileLayer.wms('http://data.datacove.eu:8080/geoserver/lu/wms', {
layers: 'lu:zhoda_sk',
format: 'image/png',
styles: 'zhoda',
transparent: true,
attribution: "Slovakia LUCAS point"
});
var lucas_point_hu = L.tileLayer.wms('http://data.datacove.eu:8080/geoserver/lu/wms', {
layers: 'lu:zhoda_hu',
format: 'image/png',
styles: 'zhoda',
transparent: true,
attribution: "Hungary LUCAS point"
});
var heat_map_sk = L.singleTile('http://data.datacove.eu:8080/geoserver/lu/wms', {
layers: 'lu:zhoda_sk',
format: 'image/png',
transparent: true,
attribution: "Slovakia Heat Map"
});
var heat_map_hu = L.singleTile('http://data.datacove.eu:8080/geoserver/lu/wms', {
layers: 'lu:zhoda_hu',
format: 'image/png',
transparent: true,
attribution: "Hungary Heat Map"
})
var land_use = L.layerGroup([landuse_sk, landuse_hu]);
var lucas_points = L.layerGroup([lucas_point_sk, lucas_point_hu]);
var heat_map = L.layerGroup([heat_map_sk, heat_map_hu]);
var states = function(json) {
states_layer.addData(json);
};
var baseMaps = {
"OSM": osm
};
var overlayMaps = {
"Borders": states_layer,
"Land Use": land_use,
"LUCAS points": lucas_points,
"Heat Map": heat_map
};
layerswitcher = L.control.layers(baseMaps, overlayMaps, {collapsed: false}).addTo(map);
map.addLayer(osm);
$.ajax({
url: "data/states.geojson",
dataType : "json"
}).done(states);
L.control.scale({"metric": true, "imperial": false}).addTo(map);
</script>
<div id="nadpis">
<h1>SDI4Apps Open Land Use<br />Thematic Quality</h1>
</div>
</body>
</html>