# Problem with ECW Raster Layer in version 10

**URL:** <https://community.thinkgeo.com/t/problem-with-ecw-raster-layer-in-version-10/8665>\
**Category:** WPF\
**Created:** [September 13, 2017, 8:46am UTC](https://community.thinkgeo.com/t/problem-with-ecw-raster-layer-in-version-10/8665 "2017-09-13T08:46:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Basyirun](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/basyirun/32/19860_2.png) [@Basyirun](https://community.thinkgeo.com/u/Basyirun)\
**Post date:** [September 13, 2017, 8:46am UTC](https://community.thinkgeo.com/t/problem-with-ecw-raster-layer-in-version-10/8665/1 "2017-09-13T08:46:07Z")

</div>

Hi,  
Recently I’d migrated to MapSuiteWPFDesktop Ver 10. The migration process was went well except for EcwRasterLayer. Previously in ver 9 all my ECW files can be loaded without any problem. Is there anything that I miss out or any changes that I need to do in ver 10?

Below are the codes that I use:

private void LoadMap\_MapInfoECW(string filename, ListecwFiles)  
{  
try  
{  
MainMap.MapUnit = GeographyUnit.DecimalDegree;

```
            //World Map Shape                
            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(string.Format(@"{0}\Countries02\{1}", MapDataPath, "Countries02.shp"));
            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(0xFF, 252, 188, 63));
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;                              

            LayerOverlay baseMapOverlay = (LayerOverlay)MainMap.Overlays["BaseMapOverlay"];
            baseMapOverlay.TileType = TileType.MultipleTile;
            baseMapOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)));
            baseMapOverlay.Layers.Add("WorldLayer", worldLayer);                

            if (ecwFiles.Count > 0)
            {
                for (int x = 0; x < ecwFiles.Count; x++)
                {
                    if (File.Exists(string.Format(@"{0}{1}", MapDataPath, ecwFiles[x])))
                    {
                                                                                
                        EcwRasterLayer ecwLayer = new EcwRasterLayer();
                        ecwLayer.DrawingException += new EventHandler<DrawingExceptionLayerEventArgs>(ecwLayer_DrawingException);
                        ecwLayer.DrawingExceptionMode = DrawingExceptionMode.DrawException;
                        
                        ecwLayer.PathFilename = string.Format(@"{0}{1}", MapDataPath, ecwFiles[x]);
                                                    
                        baseMapOverlay.Layers.Add(string.Format("{0}_{1}", filename, x.ToString()), ecwLayer);
                        
                        //this.DisplayErrorMessage("LoadMap_MapInfoECW", ecwLayer.PathFilename);
                    }                        
                }
            }

            foreach (Layer layer in baseMapOverlay.Layers)
            {
                layer.Transparency = Convert.ToSingle(layerTransparency.Value);
            }

            txtSelectedBaseMap.Text = MapInfoGSTFileNameSelected;
            
            //MainMap.Refresh();
        }
        catch (Exception exception)
        {
            this.DisplayErrorMessage("LoadMap_MapInfoECW", exception.Message);                
        }
    }

    void ecwLayer_DrawingException(object sender, DrawingExceptionLayerEventArgs e)
    {
        e.Canvas.Clear(new GeoSolidBrush(GeoColor.FromArgb(128, 255, 192, 203)));            
        System.Drawing.Bitmap tempImage = new System.Drawing.Bitmap(string.Format("{0}\\ErrorImage.png", MapDataPath));
        MemoryStream stream = new MemoryStream();
        tempImage.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
        stream.Seek(0, SeekOrigin.Begin);
        tempImage.Dispose();
        e.Canvas.DrawScreenImageWithoutScaling(new GeoImage(stream), e.Canvas.Width / 2, e.Canvas.Height / 2, DrawingLevel.LabelLevel, 0, 0, 0);
        e.Cancel = true;
    } 

```

Attached are the ecw files sample. I can’t upload all files due to upload size limitation.

[MAL\_553.zip](https://community.thinkgeo.com/uploads/default/original/3X/9/9/99f8f4607d6b95575a6fdcf15b3a83c1d97cc39b.zip) (2.4 MB)[MAL\_645.zip](https://community.thinkgeo.com/uploads/default/original/3X/0/4/04f2b345ce003427e6ad48a7e300ba6f76a10012.zip) (2.4 MB)

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [September 15, 2017, 6:43am UTC](https://community.thinkgeo.com/t/problem-with-ecw-raster-layer-in-version-10/8665/2 "2017-09-15T06:43:59Z")

</div>

Hi Basyirun,

I just create a simple sample with V10, both of your 2 files can be loaded succeed.

Please try my sample.

[8665.zip.001.zip](https://community.thinkgeo.com/uploads/default/original/3X/b/5/b5e0548c18ab330e6b53c70b79d7f0180915c09a.zip) (2.9 MB)

[8665.zip.002.zip](https://community.thinkgeo.com/uploads/default/original/3X/1/a/1a3b74f4b8b0414f02ee3a5a04d6e9c9eca82ebd.zip) (1.9 MB)

Please remove the latest .zip like this:  
 ![](https://community.thinkgeo.com/uploads/default/original/3X/d/4/d42f773b393c281e87957a719e6b3f6896af8da1.png)

Then you can get the sample.

Regards,

Don

---

<div class="post-metadata">

**Author:** ![Basyirun](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/basyirun/32/19860_2.png) [@Basyirun](https://community.thinkgeo.com/u/Basyirun)\
**Post date:** [September 26, 2017, 5:00am UTC](https://community.thinkgeo.com/t/problem-with-ecw-raster-layer-in-version-10/8665/3 "2017-09-26T05:00:20Z")

</div>

Thanks Don. I’ll give it a try and update later.

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [September 27, 2017, 2:29am UTC](https://community.thinkgeo.com/t/problem-with-ecw-raster-layer-in-version-10/8665/4 "2017-09-27T02:29:29Z")

</div>

Hi Basyirun,

Any question please let us know.

Regards,

Don
