Loding WMS Layer

Hi Jerry,
Hi dimpflmoser (aka Hotzenplotz-Hunter :wink:

I played around with your code and found a working solution in VBA:

##############

Map0.TileProvider = MapWinGIS.tkTileProvider.ProviderNone
Map0.Projection = tkMapProjection.PROJECTION_WGS84

Set objWmsLayer = New MapWinGIS.WmsLayer
Set objExtents = New MapWinGIS.Extents

objExtents.SetBounds 10.98326, 48.69167, 0, 11.0237, 48.72229, 0

objWmsLayer.BaseUrl = "https://www.lfu.bayern.de/gdi/wms/wasser/ueberschwemmungsgebiete"
objWmsLayer.BoundingBox = objExtents
objWmsLayer.DoCaching = False
objWmsLayer.Epsg = 4326
objWmsLayer.Format = "image/png32"
objWmsLayer.Layers = "hwgf_hqhaeufig"
objWmsLayer.Name = "Hochwassergefahrenfl?chen HQh?ufig"
objWmsLayer.Opacity = 63
objWmsLayer.UseCache = False
objWmsLayer.TransparentColor = 255
objWmsLayer.UseTransparentColor = True
objWmsLayer.Version = wv13

intLayerHandle = Me.Map0.AddLayer(objWmsLayer, True)
Me.Map0.LayerVisible intLayerHandle, True

Set Me.Map0.Extents = objExtents
Me.Map0.MoveTo 10.9833, 48.6918
Me.Map0.Redraw

################

It is quite usefull to log the WMS/Tile-Requests of MapWinGIS with:

Dim myGlobalSettings As MapWinGIS.GlobalSettings

If (myGlobalSettings Is Nothing) Then Set myGlobalSettings = New MapWinGIS.GlobalSettings

myGlobalSettings.LogTileErrorsOnly = True
Call myGlobalSettings.StartLogTileRequests(strPath + strTILE_LOG_FILE)

–> where strPath & strTILE_LOG_FILE need to be defined.

Here i figuerd out, that

  • the WMS-Version needs to be set, to get the CRS-Parameter used by MapWinGis compatible to this specific WMS-Server.

Hope this works for you as well.

Stay healthy and have fun.

Ciao
Stefan

1 Like