ThinkGeo.com    |     Documentation    |     Premium Support

Problems with wmsrasterlayer

Hallo,


I try to get datas from a wms-server in saxonia. You can see the uri in the code below. But all I get is the message, that the wms-server don't support the crs. I can't believe that. Can anybody help me?


 



        private void wms_sachsen()
        {
            WmsRasterLayer wmsLayer = new WmsRasterLayer(new Uri("landesvermessung.sachsen.de/ias/basiskarte4/service/SRV4TKFREE/WMSFREE_TK/wmsservice"));
            wmsLayer.Parameters.Add("layers", "ms,ueb,tk100,tk100g");
            //WmsRasterLayer wmsLayer = new WmsRasterLayer(new Uri("landesvermessung.sachsen.de/ias/basiskarte4/service/SRV4DOPFREE/WMSFREE_TK/WMSFREE_TK/wmsservice"));
            //WmsRasterLayer wmsLayer = new WmsRasterLayer(new Uri(
            wmsLayer.Parameters.Add("Exceptions", "application/vnd.ogc.se_xml");
            wmsLayer.Parameters.Add("format", "image/png");
            wmsLayer.Parameters.Add("transparent", "true");
            wmsLayer.Parameters.Add("SRS", "EPSG:31468");

            wmsLayer.Name = "WMS Layer";
            if (!wmsLayer.IsOpen)
            {
                wmsLayer.Open();
            }

            // Set Active Layer names
            foreach (string name in wmsLayer.GetServerLayerNames())
            {
                wmsLayer.ActiveLayerNames.Add(name);
            }

            wmsLayer.UpperThreshold = Double.MaxValue;
            wmsLayer.LowerThreshold = 0;
            wmsLayer.IsTransparent = true;
            wmsLayer.Crs = "EPSG:31468";
            wmsLayer.TimeoutInSecond = 35;

            if (wmsLayer.IsOpen)
            {
                wmsLayer.Close();
            }

            this.map.StaticOverlay.Layers.Add(wmsLayer.Name, wmsLayer);

        }





 


Torsten,

 


It throws that exception because it doesn't find the “EPSG:31468” on that server. After further investigation, I found that saxonia server does support the 31468 projection, but the format is a bit different from what we suppose to be.  It includes all the supported SRSs in a long string, when we are trying to get the CRS array the server supports, for example we only get one “EPSG:31468 EPSG:31469 EPSG:31470 EPSG:31471” instead of four, that makes the server failed to pass the CRS check. I think in the configuration file of the server, it's something like


<sm:srs value=”EPSG:31468 EPSG:31469 EPSG:31470 EPSG:31471”>


and we are expecting something like


<sm:srs value=”EPSG:31468”>


<sm:srs value=”EPSG:31469”>


<sm:srs value=”EPSG:31470”>


<sm:srs value=”EPSG:31471”>


We will keep working on it and check if your srs format is also right. If yes we will support it in the future release.


Thanks,


Ben