Skip to content

Instantly share code, notes, and snippets.

@graste
Last active December 18, 2015 08:19
Show Gist options
  • Save graste/5752691 to your computer and use it in GitHub Desktop.
Save graste/5752691 to your computer and use it in GitHub Desktop.
Leaflet, WMS etc.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="en" />
<title>Potsdam-Mittelmark WMS-Beispiel (GIS)</title>
<link rel="stylesheet" href="http://leaflet.cloudmade.com/dist/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="http://leaflet.cloudmade.com/dist/leaflet.ie.css" /><![endif]-->
<script type="text/javascript" src="http://leaflet.cloudmade.com/dist/leaflet.js"></script>
<script type="text/javascript" src="http://maps.stamen.com/js/tile.stamen.js?v1.1.3"></script>
<script type="text/javascript">
function initialize()
{
var layers = [];
var osm = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
minZoom: 1,
maxZoom: 18,
attribution: 'Map data © OpenStreetMap contributors'
});
var stamen = new L.StamenTileLayer("toner-lite");
var flur = new L.TileLayer.WMS("http://gis1.potsdam-mittelmark.de/wss/service/AGS_LKPM_Intern/guest/isk_allgemeines/MapServer/WMSServer/", {
layers: '0', // rot = Fluruebersicht
format: 'image/png',
transparent: 'TRUE'
});
var gemarkungen = new L.TileLayer.WMS("http://gis1.potsdam-mittelmark.de/wss/service/AGS_LKPM_Intern/guest/isk_allgemeines/MapServer/WMSServer/", {
layers: '1', // blau = Gemarkungen
format: 'image/png',
transparent: 'TRUE'
});
var grenzen = new L.TileLayer.WMS("http://gis1.potsdam-mittelmark.de/wss/service/AGS_LKPM_Intern/guest/isk_allgemeines/MapServer/WMSServer/", {
layers: '2', // magenta = Verwaltungsgrenzen
format: 'image/png',
transparent: 'TRUE'
});
layers.push(osm);
layers.push(stamen);
layers.push(flur);
layers.push(gemarkungen);
layers.push(grenzen);
var map = new L.Map("map", {
center: new L.LatLng(52.24882, 12.70157),
zoom: 10,
minZoom: 1,
maxZoom: 18,
layers: layers
});
var baselayers = {
"OpenStreetmap": osm,
"Vereinfacht": stamen
};
var overlays = {
"Flurübersicht": flur,
"Gemarkungen": gemarkungen,
"Verwaltungsgrenzen": grenzen
};
L.control.layers(baselayers, overlays).addTo(map);
var popup = L.popup();
map.on('click', function onMapClick(e) {
popup.setLatLng(e.latlng).setContent("Sie haben folgenden Punkt angeklickt: " + e.latlng.toString()).openOn(map);
});
}
</script>
</head>
<body onload="initialize()">
<p>Die einzelnen Schichten können via Menü oben rechts in der Karte (de-)aktiviert werden.<br />
Je nach Geschwindigkeit des <a href="http://gis1.potsdam-mittelmark.de/wss/service/AGS_LKPM_Intern/guest/isk_allgemeines/MapServer/WMSServer/">Web Map Service</a>
kann das Laden der Schichten (Flurübersicht, Gemarkungen und Verwaltungsgrenzen) etwas dauern. <br />
Die Daten sind aus dem <a href="http://gis1.potsdam-mittelmark.de/wss/service/URL_Downloadverzeichnis/guest/geoportal/index.htm">PM Geoportal</a>.
</p>
<div id="map" style="width:800px;height:800px"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment