ThinkGeo.com    |     Documentation    |     Premium Support

Set Projection of WmsRasterLayer - BUG?

I try to change the projection of WmsRasterLayer.




WmsRasterLayer wmsLayer = new WmsRasterLayer(new Uri("isk.geobasis-bb.de/ows/dnm.php")); 
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.TimeoutInSecond = 35;
wmsLayer.Crs = "EPSG:25833"; 

// trying both - set Crs and add parameters 
// I tested both version separatly too, without effects
wmsLayer.Parameters.Add("SRS", "EPSG:25833");

// trying to get bounding box - the bounding box is of type EPSG:4326
RectangleShape bbox = wmsLayer.GetBoundingBox();

wmsLayer.Close();

LayerOverlay lgbOverlay = new LayerOverlay("LGB");
lgbOverlay.Layers.Add(wmsLayer);
lgbOverlay.IsBaseOverlay = true;

this.map.CustomOverlays.Add(lgbOverlay);


The MapUnit I set to GeographyUnit.Meter, the CurrentExtent I set to:




this.map.CurrentExtent = new RectangleShape(240000, 5930000, 490000, 5690000); 


With this sample I can see nothing, the map is white. If I get BoundingBox for wms layer (see in the code) - the box is in the format "EPSG:4326".


If I use WmsOverlay, I can change the projection correctly:

WmsOverlay wmsOverlay = new WmsOverlay("WMS Overlay");
wmsOverlay.ServerUris.Add(new Uri("isk.geobasis-bb.de/ows/dnm.php"));
wmsOverlay.Parameters.Add("layers", "bg,siedlung,transport,vegetation,gewaesser,gewaessernamen,ortsnamen,strassennamen");
wmsOverlay.Projection = "EPSG:25833";
wmsOverlay.Parameters.Add("FORMAT", "image/png");
wmsOverlay.IsBaseOverlay = true;
this.map.CustomOverlays.Add(wmsOverlay);


Is this a bug?


Anke



Anke, 
  
 It is a bug and we will work on it, as what you did, you can use the wmsOverlay to work around for now. Thanks for pointing it out! 
  
 Ben 


Hi Ben,


look at post: gis.thinkgeo.com/Support/Dis....aspx#5364


In thos post I explain, why I can not use the WmsOverlay und that I found an bug (?) in the WmsOverlay too. I can change the projection in WmsOverlay only in the standard projection 4326. If I change the projection to 25833 and set IsBaseOverlay to false, i can not see the wms overlay. If I change the projection to 25833 and set IsBaseOverlay to true, then I see the map - but I can not use this, because I will show the world in background.


Anke



Anke,


Please look at the reply here: gis.thinkgeo.com/Support/Dis....aspx#5364


As it said, it’s a bug that we didn't have a projection property for a LayerOverlay, we will add it in the next release. Sorry for the inconvenience now.


Ben



Ben, 
  
 can you make an educated guess about the ETA of the next release? 
 Thanks. 
  
 Peter

Peter,  
  
 I think that will be available in the middle of January, which will include Core, Desktop and Web editions with all bugs (we found) fixed and some new features added. We will provide more detailed info in forum when we get closer to the release. 
  
 Ben 


Thank you. 
  
 Merry Christmas :-)

You too, Merry Christmas and Happy New Year:)