Monday 31 October 2016

Combine Leaflet with Geoserver WMS map



I'm not very skilled within the GIS world, however, I would like to know if it's possible to use this map:


http://wfs-kbhkort.kk.dk/k101/wms?service=WMS&version=1.1.0&request=GetMap&layers=k101:theme-startkort&styles=&bbox=12.451709828167994,55.63150896601625,12.64714535243575,55.72503797474024&width=512&height=495&srs=EPSG:4326&format=application/openlayers


within leaflet?


I've looked at the API for leaflet and can see that it is possible to use custom maps/tiles with the tileLayer option. However, I cannot get it to work.


Can someone point me in the right direction?



Answer



Take a look at L.tilelayer.wms in the API.


In your case you should get something like this:


var map = L.map('map').setView([55.67, 12.60], 11);


var mywms = L.tileLayer.wms("http://wfs-kbhkort.kk.dk/k101/wms", {
layers: 'k101:theme-startkort',
format: 'image/png',
transparent: true,
version: '1.1.0',
attribution: "myattribution"
});
mywms.addTo(map);

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...