-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLeafletWithGeoServer2.html
More file actions
46 lines (34 loc) · 1.1 KB
/
LeafletWithGeoServer2.html
File metadata and controls
46 lines (34 loc) · 1.1 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Leaflet with GeoServer Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
</head>
<body>
<div id="map" style="width: 600px; height: 400px"></div>
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<script>
var map = L.map('map').setView([1.3571318,103.8080804], 13);
mapLink = '<a href="http://www.kenneth.net">(Kenneth)</a>';
L.tileLayer.wms("http://localhost:8080/geoserver/hoc/wms", {
layers: 'hoc:SG',
format: 'image/png',
transparent: true,
version: '1.1.0',
attribution: "Hu ChiaWei "+mapLink
}).addTo(map);
L.marker([1.3571318,103.8080804]).addTo(map)
.bindPopup("<b>Hello world!</b><br />I am a popup.").openPopup();
var popup = L.popup();
function onMapClick(e) {
popup
.setLatLng(e.latlng)
.setContent("You clicked the map at " + e.latlng.toString())
.openOn(map);
}
map.on('click', onMapClick);
</script>
</body>
</html>