Skip to content

Instantly share code, notes, and snippets.

@henningjensen
Created March 25, 2014 07:32
Show Gist options
  • Save henningjensen/9756768 to your computer and use it in GitHub Desktop.
Save henningjensen/9756768 to your computer and use it in GitHub Desktop.
Leaflet med grunnkart fra Kartverket
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
</head>
<body>
<div id="map" style="width:700px; height:500px;">
</div>
<script>
var map = L.map('map', { minZoom: 0, maxZoom: 18 }).setView([62.03, 11.19], 5);
var topolayer = new L.TileLayer.WMS("http://opencache.statkart.no/gatekeeper/gk/gk.open", {
layers: 'norges_grunnkart',
format: 'image/png',
transparent: false,
version: "1.0",
attribution: "Kartverket"
}).addTo(map);
var southWest = new L.LatLng(63.28735, 10.58363),
northEast = new L.LatLng(63.63414, 11.78317),
bounds = new L.LatLngBounds(southWest, northEast);
// create an orange rectangle
L.rectangle(bounds, { color: "#ff7800", weight: 1 }).addTo(map);
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment