Skip to content

Instantly share code, notes, and snippets.

@alexgleith alexgleith/index.html
Last active Dec 6, 2017

Embed
What would you like to do?
Simple Leaflet GeoServer Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1,user-scalable=no,maximum-scale=1,width=device-width">
<title>Example Leaflet</title>
<link rel="stylesheet" href="https://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css">
</head>
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
}
</style>
<body>
<div id="map"></div>
<script src="//cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script>
var map = new L.Map('map', { center: new L.LatLng(-42.7946,147.2576), zoom: 11, attributionControl:true, zoomControl:false, minZoom:6});
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttrib='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
var osm = new L.TileLayer(osmUrl, {minZoom: 8, maxZoom: 18, attribution: osmAttrib});
map.addLayer(osm);
var wmsLayer= L.tileLayer.wms("https://maps.gcc.tas.gov.au/geoserver/gwc/service/wms", {
layers: 'GCC_cc:Stormwaterpipes',
format: 'image/png',
transparent: true
});
map.addLayer(wmsLayer);
</script>
</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.