WMS Layer Query

I am still trying to get our aerial photo to work. The GIS dept has said that they cannot make it a cached Map with tiles as it requires too much storage space. They have created a WMS that I can access with the following URL:

In my app, I have the following
Dim objWmsLayer As New mapwingis.WmsLayer
Dim objExtents As New mapwingis.extents

’ Had to use EPSG:0 as it would not go to the correct place on the Map if I did not - units for the Map are X/Y Coords
objExtents.SetBounds -30.268996, 30.392826, 0, -29.499835, 31.187492, 0
With objWmsLayer
.BaseUrl = “http://gis.durban.gov.za/arcgis/services/WebViewers/MRF2019/ImageServer/WMSServer
.BoundingBox = objExtents
.DoCaching = False
.Epsg = 4326
.Format = “image/png”
.Layers = 0
.UseCache = False
'.Opacity = 63
'.TransparentColor = 255
'.UseTransparentColor = True
.Version = tkWmsVersion.wv13
End With
intLayerHandle = Me.Map1.AddLayer(objWmsLayer, True)
Me.Map1.LayerVisible intLayerHandle, True

Set Me.Map1.extents = objExtents

Whatever I do this always just shows blank white - I saw someone said they had to move the X/Y coords around but it seems this is not so for version 1.3, but I did it anyway just to see and still no aerial photo.

Can anyone point me in the right direction as I am going around in circles.

Also, I am wondering will the zooming in be handled by the Map Service .


Colleen Crawford

In the end I got it to work. I am using v5.2.4

I was only able to use ESPG: 4236 - My Map is Google Mercator so I needed the line gs.AllowProjectionMismatch = True. I also had to switch the Minx and Miny and MaxX and MaxY, if I did not then a blank white area displayed. When accessing via a web url I did not need to switch them around. If I made the projection PROJECTION_WGS84, then the aerial photo displayed in the incorrect place.
I did try to use the google mercator extent bounds but it did not work.

The following code is working correctly.

Dim objWMSLayer As New MapWinGIS.WmsLayer
Dim objExtents As New MapWinGIS.extents
Dim gs As New MapWinGIS.GlobalSettings

If Me.DispAerialPhoto = True Then
’ Can’t display both together
If Me.DispStreetMap = True Then
Me.DispStreetMap = False
End If
Map1.LayerVisible(hndRegions) = False
Map1.TileProvider = MapWinGIS.tkTileProvider.ProviderNone
’ Shows full map, in incorrect place
'Map1.Projection = tkMapProjection.PROJECTION_WGS84
’ If use google mercator - need this - displays in correct place
gs.AllowProjectionMismatch = True

’ Had to use EPSG:4326 as it would not go to the correct place on the Map if I did not - my units for the Map are X/Y Coords
'objExtents.SetBounds -30.268996, 30.392826, 0, -29.499835, 31.187492, 0
’ Also had to reverse minx and minY
objExtents.SetBounds 30.392826, -30.268996, 0, 31.187492, -29.499835, 0
With objWMSLayer
.BaseUrl = “http://gis.durban.gov.za/arcgis/services/WebViewers/MRF2019/ImageServer/WMSServer
.BoundingBox = objExtents
.Epsg = 4326
.Format = “image/png32”
.Layers = 0
.Name = “AerialPhoto”
.DoCaching = False
.UseCache = False
.Version = tkWmsVersion.wv13
End With
hndAerialPhoto = Me.Map1.AddLayer(objWMSLayer, True)
Me.Map1.LayerVisible hndAerialPhoto, True
Map1.LayerVisible hndRegions, True
Map1.RemoveLayer (hndAerialPhoto)
End If
Map1.Redraw3 tkRedrawType.RedrawSkipAllLayers, True