WMS Layer Query

Hi
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:
http://gis.durban.gov.za/arcgis/services/WebViewers/MRF2019/ImageServer/WMSServer?VERSION=1.3.0&REQUEST=GetMap&CRS=epsg:4326&BBOX=-30.268996,30.392826,-29.499835,31.187492&format=image/png&layers=0&styles=default&width=760&height=360

In my app, I have the following

Dim objWmsLayer As New mapwingis.WmsLayer
Dim objExtents As New mapwingis.extents
'COMMENTS
'<BoundingBox CRS="EPSG:4326" minx="-30.268996" miny="30.392826" maxx="-29.499835" maxy="31.187492"/>
'<BoundingBox CRS="EPSG:0" minx="-58426.679000" miny="-3349932.826366" maxx="18041.420969" maxy="-3264822.226400"/>
' 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
'END COMMENTS
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 .

Thanks

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
    'COMMENTS       
    '<BoundingBox CRS="EPSG:4326" minx="-30.268996" miny="30.392826" maxx="-29.499835" maxy="31.187492"/>
    '<BoundingBox CRS="EPSG:0" minx="-58426.679000" miny="-3349932.826366" maxx="18041.420969" maxy="-3264822.226400"/>
    ' 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
' END COMMENTS
    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
Else
    Map1.LayerVisible hndRegions, True
    Map1.RemoveLayer (hndAerialPhoto)
End If
Map1.Redraw3 tkRedrawType.RedrawSkipAllLayers, True

Thanks for sharing the working code.
Projections are always a pain.

I’ll close this old topic now.