Your piece of code seems to be good in theory. As I used arcGIS/Leaflet in exactly the same way.
But the problem could come from missing spatial reference (or maybe incorrect format (image/png or image/jpeg).
For the spatial reference, here is how Leaflet works :
- Leaflet expects default spatial reference : EPSG:3857 / WGS84
- But you can change it by an other one with JS plugin like Proj4leaflet by Kartena.
It's really easy and helpful. Works like this (for EPSG:3006) :
You define your new crs
// SWEREF99 TM (EPSG:3006) with map's pixel origin at SWEREF99 TM coordinate (0, 0)
var crs = new L.Proj.CRS('EPSG:3006',
'+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs',
{
resolutions: [
8192, 4096, 2048, 1024, 512, 256, 128
],
origin: [0, 0]
})
And include it in your map :
var map = new L.Map('map', {
crs: crs
});
You can find Spatial References here.
I get the same result
But I don't see WMS in the Supported Interfaces of the service:
In contrast, An ArcGIS Server service with WMS Supported Interfaces work without problem
So I suppose that's the reason (no WMS service).
Best Answer
I am having the same issue with a Loudoun County, VA ImageService for 2017 orthographic satellite imagery:
https://logis.loudoun.gov/image/rest/services/Aerial/COLOR_2017/ImageServer
I partially overcame this issue by accessing their Imagery folder as opposed to their Aerial folder. Their imagery folder came with a WMTS link, which works with "Add WMS/WMTS Layer", but the projection is off and I cannot seem to reproject it properly. I doubt it is an issue with the county's data and I presume it is a limitation inside of QGIS that is preventing me from solving this issue. I noticed your server has a WMTS option for the 2015 imagery, which may provide you a less than optimal workaround. Hopefully you don't have the same issue as me, where projections are concerned.