-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathmapserver-wms-railways.html
54 lines (48 loc) · 1.45 KB
/
mapserver-wms-railways.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Mapserver WMS</title>
<link rel="stylesheet" href="./css/common.css">
<link rel="stylesheet" href="./css/ol.css">
</head>
<body>
<div id="map" class="map"></div>
<script src="./js/ol.js"></script>
<script>
let map = new ol.Map({
target: 'map',
layers: [
// new ol.layer.Tile({
// source: new ol.source.OSM()
// })
],
view: new ol.View({
projection: "EPSG:4326",
center: [108, 35],
zoom: 4.5
})
});
let railways = new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'http://cheerfun.xyz:8000/cgi-bin/mapserv',
params: {
map: "/mapfiles/basemap/railways.map",
service: "wms",
version: "1.3.0",
request: "getMap",
layers: "rail",
width: 256,
height: 256,
crs: "epsg:4326",
format: "image/png"
},
serverType: 'mapserver',
})
});
map.addLayer(railways);
</script>
</body>
</html>