ThinkGeo.com    |     Documentation    |     Premium Support

WMS overlay as BackgroundOverlay

When trying to add a WMS image as my backgroundoverlay, as was the case with the previous version of Map Suite, none of my shapefiles appear to draw over the WMS image.


                    'This is how to do the WMS I think but it is bugged in this version.
                    Dim wms As New WmsOverlay("WMS Overlay")
                    wms.Parameters.Add("layers", "massgis:GISDATA.IMG_COQ2005")
                    wms.Parameters.Add("SRS", "EPSG:26986")
                    wms.Parameters.Add("FORMAT", "image/gif")
                    wms.ServerUris.Add(New Uri("giswebservices.massgis.state.ma.us/geoserver/wms"))
                    wms.TileType = TileType.MultipleTile
                    wms.TileHeight = 256
                    wms.TileWidth = 256
                    wms.IsBaseOverlay = True

                    GeoMap.BackgroundOverlay = wms
                    GeoMap.BackgroundOverlay.IsVisible = True


Edit: Also, it seems like the loading bar that indicating whether or not features have finished drawing does not take place with WMS layers. Shouldn't it?



Nelson, 
  
 Perhaps your current extent or map unit is not set correctly. Here are the codes which works fine, please have a look to see if there is some differences with yours.  
  
  
            Map1.MapBackground.BackgroundBrush = New GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"))
            Map1.CurrentExtent = New RectangleShape(14284.766508075274, 970938.13616751786, 349501.75956297404, 766411.6168791271)
            Map1.MapUnit = GeographyUnit.Meter
 
            'This is how to do the WMS I think but it is bugged in this version.
            Dim wms As New WmsOverlay(“WMS Overlay”)
            wms.Parameters.Add(“layers”, “massgis:GISDATA.IMG_COQ2005”)
            wms.Parameters.Add(“SRS”, “EPSG:26986”)
            wms.Parameters.Add(“FORMAT”, “image/gif”)
            wms.ServerUris.Add(New Uri(“giswebservices.massgis.state.ma.us/geoserver/wms”))
            wms.TileType = TileType.MultipleTile
            wms.TileHeight = 256
            wms.TileWidth = 256
            wms.IsBaseOverlay = True
 
            Map1.BackgroundOverlay = wms
 
  
 Ben

My extents and units of measure are set correctly. The extent I use is:


Dim rectFullExtents As New RectangleShape(240142.0, 918093.0, 247535.0, 910527.0)


I should note that my WMS layer appears correctly, and seemingly all of my shapefile features seem to be loaded without error but they are not displayed. Removing the WMS layer alleviates the issue. I have tried to alter the opacity of the WMS but it has no visible effect; probably because it is a base layer.


Are you able to draw features on top of this WMS layer as defined?


Edit: I apologize, I suppose you wouldn't easily be able to do so without some data...  Attached you will find a small hydro layer which should consist of a body of water that should line up with the WMS. I suppose even if it doesn't line up, just its display would be an improvement.



323-hydro.zip (78.1 KB)

Was there an answer to this by any chance? Certainly not critical, but I was hoping to get a feel for WMS support with feature overlay on top.



Nelson, 
  
   You picked the wrong week… :-(  I don’t know much about it however Monday we will have the gurus back and we will have some juicy info for you.  Please reply back to this to keep it in the queue if you don’t mind. 
  
 David

No problem. The ortho photos can wait, haha.

Nelson,  
  
 The following code gets wms overlay with features on top of it. Let us know for any queries. 
  
  
    Dim wms As New WmsOverlay("WMS Overlay")
    wms.Parameters.Add("layers", "massgis:GISDATA.IMG_COQ2005")
    wms.Parameters.Add("SRS", "EPSG:26986")
    wms.Parameters.Add("FORMAT", "image/gif")
    wms.ServerUris.Add(New Uri("giswebservices.massgis.state.ma.us/geoserver/wms"))
    wms.TileType = TileType.MultipleTile
    wms.TileHeight = 256
    wms.TileWidth = 256
    wms.IsBaseOverlay = True

    Dim layerOverlay As New LayerOverlay("Water")
    Dim waterLayer As New ShapeFileFeatureLayer("C:\hydro\Lynn_Hydro.shp")
    waterLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(180, 243, 239, 228), GeoColor.FromArgb(255, 218, 193, 163), 1)
    waterLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
    layerOverlay.Layers.Add(waterLayer)
    layerOverlay.IsBaseOverlay = False
 
    Map1.CustomOverlays.Add(wms)
    Map1.CustomOverlays.Add(layerOverlay)
 
    waterLayer.Open()
    Dim extent As RectangleShape = waterLayer.GetBoundingBox()
    waterLayer.Close()
    Map1.CurrentExtent = extent
 
  
 Thanks, 
  
 Ben