Last active
March 29, 2023 17:24
-
-
Save alexgleith/8ff4794153c7fc0124b3 to your computer and use it in GitHub Desktop.
Simple Leaflet GeoServer Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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