I am new to web mapping and web in general.
I am trying to add the default WMTS Italy mosaic that can be found in GeoServer by default (nurc:mosaic, namely) to my map via Leaflet.
I tried to tweak following code: https://github.com/mylen/leaflet.TileLayer.WMTS
I get the WMTS link simply right clicking on GeoServer's Web Admin page WMTS 1.0.0 and copy the link location. Here it is: http://localhost:8081/geoserver/gwc/service/wmts?REQUEST=GetCapabilities
And here is my code: Demo leaflet.TileLayer.WMTS
// The WMTS URL
var url = "http://localhost:8081/geoserver/gwc/service/wmts?REQUEST=GetCapabilities";
var italy = new L.TileLayer.WMTS( url ,
{
layer: 'nurc:mosaic',
style: "",
tilematrixSet: "EPSG:4326",
format: "image/png"
}
);
var map = L.map('map').setView([37, 24], 4);
L.control.scale({'position':'bottomleft','metric':true,'imperial':false}).addTo(map);
var osm = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
var baseLayers = {
"ItalyWMTS" : italy,
"OpenStreetMap": osm
};
L.control.layers(baseLayers).addTo(map);
What am I missing ?