Skip to content

Instantly share code, notes, and snippets.

@Avec112
Last active Jun 22, 2020
Embed
What would you like to do?
GeoServer demo using Leaflet, OpenStreetMap and an italian GeoServer
<!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"-->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""/>
</head>
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
}
</style>
<body>
<div id="map"></div>
</body>
<!--script src="//cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script-->
<!-- Make sure you put this AFTER Leaflet's CSS -->
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"
integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
crossorigin="">
</script>
<script>
var map = new L.map('map').setView([42.7946,12.82], 7);
//var map = new L.map('map', { center: new L.LatLng(42.7946,12.82), zoom: 7, attributionControl:true, zoomControl:false, minZoom:6});
var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
//var osmUrl='https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png';
var osmAttrib='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
var osm = new L.TileLayer(osmUrl, {minZoom:1, maxZoom: 18, attribution: osmAttrib});
map.addLayer(osm);
/*var Linea_costa= L.tileLayer.wms("https://demo.geo-solutions.it/geoserver/test/wms", {
layers: 'test:Linea_costa',
format: 'image/png',
transparent: true
});*/
//map.addLayer(Linea_costa);
/*var areeverdiPolygon= L.tileLayer.wms("https://demo.geo-solutions.it/geoserver/test/wms", {
layers: 'test:areeverdiPolygon',
format: 'image/png',
transparent: true
});*/
//map.addLayer(areeverdiPolygon);
var layer0= L.tileLayer.wms("https://demo.geo-solutions.it/geoserver/test/wms", {
//layers: 'test:thematism_comuni',
layers: 'test:thematism_regioni',
format: 'image/png',
transparent: true
});
map.addLayer(layer0);
/*var layer= L.tileLayer.wms("https://demo.geo-solutions.it/geoserver/test/wms", {
//layers: 'unesco:Unesco_point',
//layers: 'nurc:Arc_Sample',
layers: 'topp:states-tasmania',
format: 'image/png',
transparent: true
});
map.addLayer(layer);*/
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment