ThinkGeo.com    |     Documentation    |     Premium Support

Distortion of the raster view from a WMS

I am trying to preview a published raster image on a MapServer server.

The map published with EPSG: 4326, is only displayed when I set Axys order to XY. However, the view is distorted.

Can you help me solve this problem?

   string url = "http://localhost:8080/cgi-bin/mapserv.exe?map=/ms4w/apps/patria/patria.map";
    wpfMap.MapUnit = GeographyUnit.DecimalDegree;            
    
    Uri theUrl = new System.Uri(url);
    WmsRasterLayer wms = new WmsRasterLayer(theUrl);
    wms.AxisOrder = ThinkGeo.MapSuite.Layers.WmsAxisOrder.XY;            
    
    wms.Exceptions = "XML"; 
    wms.ActiveLayerNames.Add("ortofoto");
        
    wms.Crs = "EPSG:4326";
    //wms.Crs = "EPSG:3857";

    // -------------------
    wms.Open();
    //string v = wms.GetServiceVersion();
    var bb = wms.GetBoundingBox();
    
    wms.UpperThreshold = double.MaxValue;
    wms.LowerThreshold = 0;
    
    LayerOverlay wmsOverlay = new LayerOverlay();
    
    wmsOverlay.Name = "WMS";

    //wmsOverlay.TileType = TileType.HybridTile;
    wmsOverlay.TileType = TileType.SingleTile;            
    wmsOverlay.Layers.Add(wms);

    // -------------------
    wpfMap.CurrentExtent = bb;                        
    wpfMap.Overlays.Add(wmsOverlay);                       
    wpfMap.Refresh();

Hi Joao,

I’m not sure whether the issue is caused by the projection or the aspect ratio of the map.
You can view the request of raster image as following and compare with the url in your second screenshot:

wmsImageLayer.SendingWebRequest += WmsImageLayer_SendingWebRequest;

    private void WmsImageLayer_SendingWebRequest(object sender, SendingWebRequestEventArgs e)
    {
        var uri = e.WebRequest.RequestUri;
    }

Could you please show us a temporary server which we can connect to test?

Thanks,
Emil