ThinkGeo.com    |     Blog    |     Wiki    |     Support

Issues with some WMS

Hello,
some of our costumers are using following wms-services:

(a) PegelOnline
http://www.pegelonline.wsv.de/webservices/gis/wms/aktuell/mnwmhw
If they load the service in a map with epsg-code: 25832 nothing is drawing. I can confirm this behavier. When I try to debug the project, i see that the methodes “SendingWebRequest” and “SentWebRequest” are never reached. So I have no idea whats going on.

(b) WaterDatabase
http://atlas.wsv.bund.de/wadaba/wms
A exception occours in the DrawCore Method of the Overlay the WmsLayer is in.
bei ThinkGeo.MapSuite.ValidatorHelper.CheckObjectIsNotNull(Object parameterObject, String parameterName)
bei ThinkGeo.MapSuite.Shapes.BaseShape.Intersects(BaseShape targetShape)
bei ThinkGeo.MapSuite.Layers.WmsRasterLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
I use also the epsg-code 25832.

© OsmFree - a Service from a vendor in saxionia
http://osmwms.itc-halle.de/maps/osmfree
It is like in case a.

All the costumers mentioned that the services works good in a app from us build with MapSuite 7.0. Now we are using MapSuite 10.4.

Are there any suggestions?
Regards Torsten

Hi Torsten,

For your link a, you can view it’s capability here:

http://www.pegelonline.wsv.de/webservices/gis/wms/aktuell/mnwmhw1?request=GetCapabilities&service=WMS

If you view the XML you will see it’s bouding box is like this:

<LatLonBoundingBox minx="5.09019" miny="46.9823" maxx="15.9068" maxy="55.1555" />
<BoundingBox SRS="EPSG:31467"
            minx="3.25047e+06" miny="5.22116e+06" maxx="3.94202e+06" maxy="6.1139e+06" />

If you render it under 4326, it works well:

And here is the test code:

            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;

        WmsRasterLayer wmsLayer = new WmsRasterLayer(new Uri("http://www.pegelonline.wsv.de/webservices/gis/wms/aktuell/mnwmhw"));
        wmsLayer.SendingWebRequest += Wms_SendingWebRequest;
        wmsLayer.ActiveLayerNames.Add("PegelonlineWMS");
        wmsLayer.ActiveStyleNames.Add("default");
        wmsLayer.Crs = "EPSG:4326";
        wmsLayer.OutputFormat = "image/png";


        LayerOverlay layerOverlay = new LayerOverlay();

        layerOverlay.Layers.Add(wmsLayer);
        winformsMap1.Overlays.Add(layerOverlay);
        
        winformsMap1.CurrentExtent =new RectangleShape(5.09019, 55.1555, 15.9068, 46.9823);

        winformsMap1.Refresh();

And this code works well for 31467 just simple change, because the 31467 list its bounding box in capability.

       wmsLayer.Crs = "EPSG:31467";

        Proj4Projection proj4 = new Proj4Projection(4326, 31467);
        proj4.Open();
        winformsMap1.CurrentExtent = proj4.ConvertToExternalProjection(new RectangleShape(5.09019, 55.1555, 15.9068, 46.9823)) as RectangleShape;

If the bounding box is not listed in the capability but you want to use it for example 3857 or 25832 you should want write a custom class and it should works.

    public class CustomWmsRasterLayer : WmsRasterLayer
{
    public CustomWmsRasterLayer(Uri uri) : base(uri)
    {

    }

    protected override RectangleShape GetBoundingBoxCore()
    {
        RectangleShape rect = base.GetBoundingBoxCore();

        if (Crs == "EPSG:25832")
        {
            Proj4Projection proj4 = new Proj4Projection(4326, 25832);
            proj4.Open();
            rect = proj4.ConvertToExternalProjection(rect) as RectangleShape;
        }

        return rect;
    }
}

        private void LoadServer1()
    {
        winformsMap1.MapUnit = GeographyUnit.Meter;

        CustomWmsRasterLayer wmsLayer = new CustomWmsRasterLayer(new Uri("http://www.pegelonline.wsv.de/webservices/gis/wms/aktuell/mnwmhw"));
        wmsLayer.SendingWebRequest += Wms_SendingWebRequest;
        wmsLayer.ActiveLayerNames.Add("PegelonlineWMS");
        wmsLayer.ActiveStyleNames.Add("default");
        wmsLayer.Crs = "EPSG:25832";
        wmsLayer.OutputFormat = "image/png";

        LayerOverlay layerOverlay = new LayerOverlay();

        layerOverlay.Layers.Add(wmsLayer);
        winformsMap1.Overlays.Add(layerOverlay);

        Proj4Projection proj4 = new Proj4Projection(4326, 25832);
        proj4.Open();
        winformsMap1.CurrentExtent = proj4.ConvertToExternalProjection(new RectangleShape(5.09019, 55.1555, 15.9068, 46.9823)) as RectangleShape;
        
        winformsMap1.Refresh();
    }

I think this should be the problem of capability in server, but I also will ask our developer did research on it.

Wish that’s helpful.

Regards,

Ethan

Hi,

For your link b: http://atlas.wsv.bund.de/wadaba/wms

I cannot make it works even under 4326, if you can find a valid request url I can help you look into where is the problem, as below is my test url:

http://atlas.wsv.bund.de/wadaba/wms?REQUEST=GetMap&BBOX=4.427516796875,42.890640625,16.226833203125,59.589859375&WIDTH=760&HEIGHT=537&LAYERS=wadaba_wms_www&STYLES=default&FORMAT=image/png&CRS=EPSG:4326&VERSION=1.3.0&SERVICE=WMS&EXCEPTIONS=XML&sld_version=1.1.0

For your link c:

Because network problem, I cannot open the server, but if it’s the same reason like link a, you can just try the same solution.

Wish that’s helpful.

Regards,

Ethan

Hi Ethan,

Your suggestions are very helpful. I modified the code and now it works very well. For the service http://atlas.wsv.bund.de/wadaba/wms I will ask our costumers to get a valid test url.

Your code works also for my link c.

Regards
Torsten

Hi Torsten,

Thanks for feedback. We tested the service(http://atlas.wsv.bund.de/wadaba/wms), and found it works fine. Here is our test code:

Map1.MapUnit = GeographyUnit.DecimalDegree;
LayerOverlay layerOverlay = new LayerOverlay();
WmsRasterLayer wmsLayer = new WmsRasterLayer(new Uri("http://atlas.wsv.bund.de/wadaba/wms"));
wmsLayer.ActiveLayerNames.Add("wadaba_wms_www");
wmsLayer.ActiveStyleNames.Add("default");
wmsLayer.Crs = "EPSG:4326";
wmsLayer.OutputFormat = "image/png";
wmsLayer.Exceptions = "INIMAGE";
layerOverlay.Layers.Add(wmsLayer);
Map1.Overlays.Add(layerOverlay);
Map1.CurrentExtent = new RectangleShape(46.8457, 15.4688, 55.6348, 5.18555);
Map1.Refresh();

If your have any questions, please feel free to contact us.

Thanks,
Rex