Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Working proj4 version
<!DOCTYPE html>
<html>
<head>
<title>Camping</title>
<meta https-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.1/dist/leaflet.css" />
<style type="text/css">
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
}
.popup{
font: 14px Arial;
width:200
}
</style>
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.0.1/dist/leaflet.js"></script>
<script src="proj4.js"></script>
<script src="proj4leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script src="https://maps.dartmoor.gov.uk/js/leaflet.wms.js"></script>
<!-- <script src="https://maps.dartmoor.gov.uk/js/dnpa_boundary.js"></script> -->
<script>
if (L.Browser.ielt9) {
alert('As your web browser is out of data some parts of this web map might not work. Please consider updating your version of Internet Explorer to version 11 or higher');
}
var crs = new L.Proj.CRS('EPSG:27700', '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs', {
resolutions: [2800, 1400, 700, 350, 175, 84, 42, 21, 11.2, 5.6, 2.8, 1.4, 0.7, 0.35, 0.14, 0.07],
});
var map = new L.Map('map',
{
crs: crs,
maxzoom:19,
minzoom: 10,
zoom: 5,
center: new L.LatLng(50.5686, -3.921)
});
var year = new Date().getFullYear()
var tms = L.tileLayer('https://maps.dartmoor.gov.uk/geoserver/gwc/service/tms/1.0.0/os_rasters@EPSG:27700@png/{z}/{x}/{y}.png', {
attribution: "Crown copyright and database rights "+year+" Ordnance Survey 100024842",
tms: true
}).addTo(map);
tms.setOpacity(0.7)
//boundary.addTo(map);
var URL = 'https://maps.dartmoor.gov.uk/geoserver/wms/'
var source = L.WMS.source(
URL,{
"format": "image/png",
"transparent": "true",
"identify": false
});
/*var camping = source.getLayer('general:camping');
camping.addTo(map);*/
var boundary = source.getLayer('general:dnp_boundary');
boundary.addTo(map);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.