x

Leaflet und LayerSwitch


Geschrieben von aighes (Gast) am 10. Februar 2012 11:54:43: [flux]

Hallo,
ich versuche gerade eine Karte auf Basis von Leaflet zu erstellen. Die Anzeige der Layer funktioniert auch soweit, nur den LayerSwitch bekomm ich einfach nicht zum laufen. Wobei ich mich egtl. an das Example gehalten habe.

Hat einer von euch das schonmal hinbekomen und kann mir behilflich sein?

DEr peinliche Fehler ist nun auch hier behoben.

<!DOCTYPE␣html>
<html>
<head>
<title>Leaflet␣Layers␣Control␣Example</title>
<meta␣charset="utf-8"␣/>
<link␣rel="stylesheet"␣href="leaflet/leaflet.css"␣/>
<!--[if␣lte␣IE␣8]><link␣rel="stylesheet"␣href="leaflet/leaflet.ie.css"␣/><![endif]-->
<style>
body␣{
padding:␣0;
margin:␣0;
}
html,␣body,␣#map␣{
height:␣100%;
}
</style>
<script␣src="leaflet/leaflet.js"></script>
</head>
<body>
<div␣id="map"></div>
<script>
var␣mapquest_osm␣=␣new␣L.TileLayer("http://{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png",␣{maxZoom:␣14,␣minZoom:␣1,␣attribution:␣'Data,␣imagery␣and␣map␣information␣provided␣by␣<a␣href="http://open.mapquest.co.uk"␣target="_blank">MapQuest</a>,␣<a␣href="http://www.openstreetmap.org/"␣target="_blank">OpenStreetMap</a>␣and␣contributors,␣<a␣href=\"http://creativecommons.org/licenses/by-sa/2.0/\"␣target=\"_blank\">CC-BY-SA</a>',␣subdomains:␣["otile1","otile2","otile3","otile4"]});
var␣mapnik_osm␣=␣new␣L.TileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",␣{maxZoom:␣14,␣minZoom:␣1,␣attribution:␣"Map:␣&copy;␣2012␣<a␣href=\"http://www.openstreetmap.org\"␣target=\"_blank\"␣style=\"\">OpenStreetMap␣contributors</a>,␣<a␣href=\"http://creativecommons.org/licenses/by-sa/2.0/\"␣target=\"_blank\">CC-BY-SA</a>"});
var␣radreise_wiki␣=␣new␣L.TileLayer("http://localhost/radreise-wiki/{z}/{x}/{y}.png",␣{maxZoom:␣14,␣minZoom:␣1});
var␣map␣=␣new␣L.Map('map',␣{center:␣new␣L.LatLng(50,␣2),␣zoom:␣5,␣layers:␣[mapquest_osm,␣radreise_wiki]});
map.addControl(new␣L.Control.Layers({"MapQuest␣Open":mapquest_osm,␣"Mapnik":mapnik_osm},␣{"RadReise-Wiki":radreise_wiki}));
</script>
</body>
</html>

Antworten: