ThinkGeo.com    |     Documentation    |     Premium Support

How can I set the projection used for WMS layers

Hello,


I'm trying to use a WMS layer as Background. The WMS server I use has the capabilities to provide some images using EPSG:4326 or EPSG:2039. Images are stored on the server using EPSG:2039 projection (Israel TM Grid), so for performance reasons, I would like to be able to use the native projection of the images.


How can I set MapSuite to use this projection?

It seems that the SRS code placed in the WMS requests is EPSG:4326 all over the time. Here is the URL used by OpenLayers to request my WMS server.


Here is my C# code:



protected void Page_Load(object sender, EventArgs e) {

    Map1.MapUnit = GeographyUnit.Meter;
    Map1.CurrentExtent = new RectangleShape(120000, 680000, 220000, 580000);

    Map1.BackgroundMap.WmsMap.Name = "Israel";
    Map1.BackgroundMap.WmsMap.ServerUri = new Uri(@"localhost/mapserver/cgi-bin/mapserv.exe?map=..\\maps\\WmsIsrael.map&");
    Map1.BackgroundMap.WmsMap.Parameters.Add("layers", "Background");
    Map1.BackgroundMap.WmsMap.Parameters.Add("srs", "EPSG:2039");

    Map1.MousePosition.Enabled = true;
    Map1.PanZoomBar.Enabled = true;

}


Thanks a lot


Nicolas



Nicolas, 

This problem has been solved in the latest version which will be available pretty soon. Here is the code and you will find the generated request URL includes the SRS info with EPSG 2039. 



if (!IsPostBack) 

// Initialize the map 
Map1.MapUnit = GeographyUnit.DecimalDegree; 
Map1.BackgroundFillBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean); 
Map1.CurrentExtent = new RectangleShape(-15, 27.5, 5, 7.5); 

WmsOverlay wms = new WmsOverlay("WMS Layer"); 
wms.ServerUris.Add(new Uri(@"wmssamples.thinkgeo.com/WmsServer.aspx)); 
wms.Parameters.Add("layers", "Countries02,USStates,USMajorCities"); 
wms.Parameters.Add("srs", "EPSG:2039"); 

Map1.CustomOverlays.Add(wms); 





The new version will be out maybe early next week. 

Ben.

Thank you very much Ben. 
 I’m really impatient to try your next version. 


Just wait a couple days. I’m sure it will not let you down. :) 
  
 Ben