ThinkGeo.com    |     Documentation    |     Premium Support

Error showing ECW-Files

Hi;

I try to show some ecw-files on the map. Epsg-Code is 25833. When i zoom in, sometimes the Image will not draw correctly - see attached Pictures.

What is my mistake?


Hi,

In fact we don’t suggest to reproject raster layer, if possible please ask data provider to get the raster source under target projection.

From your screen shot, it looks the image get stretched, we hadn’t met that before. Please upload a sample with your data to reproduce it, so we can make sure where is the problem.

And if you are using projection, please make sure the extent is in valid area.

Regards,

Ethan

Hallo Ethan,
thanks for your prompt answer. We don’t use Projections for rasterfiles yet. I created a small Sample-Project in Winforms (Today I can’t download any WPF-packages from nuget in my VS 2017 - Error 403 - forbidden)
When you zoom in, the Image will not draw correctly. These occours with all 3 ecw-files.

The datafiles you will find here in Folder Thinkgeo

Regards
Torsten

My Samplecode:

 public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.Load += Form1_Load;
        }

        string myDataPath = @"d:\___________\WindowsFormsApplication1\WindowsFormsApplication1\Datas\";

        string ecw_epsg_code_31468 = "Luftbild2008bis2010.ecw";
        string ecw_epsg_code_25833 = "DOP20RGBI_33384-5884-5924.ecw";
        string ecw_epsg_code_2398 = "Stadtplan_LS150_20150624.ecw";

        void Form1_Load(object sender, EventArgs e)
        {
            this.winformsMap1.MapUnit = ThinkGeo.MapSuite.GeographyUnit.Meter;
            
            //this.loadEcw(System.IO.Path.Combine(myDataPath, ecw_epsg_code_25833));
            //this.loadEcw(System.IO.Path.Combine(myDataPath, ecw_epsg_code_2398));
            this.loadEcw(System.IO.Path.Combine(myDataPath, ecw_epsg_code_31468));
        }

        void loadEcw(string pathFileName)
        {
            if (!System.IO.File.Exists(pathFileName)) return;
            this.winformsMap1.Overlays.Clear();
            ThinkGeo.MapSuite.Layers.EcwRasterLayer layer = new ThinkGeo.MapSuite.Layers.EcwRasterLayer(pathFileName);
            layer.Open();
            if (layer.HasBoundingBox)
            {
                var bb = layer.GetBoundingBox();
                this.winformsMap1.CurrentExtent = bb;
            }
            layer.Close();
            ThinkGeo.MapSuite.WinForms.LayerOverlay overlay = new ThinkGeo.MapSuite.WinForms.LayerOverlay();
            overlay.Layers.Add(layer);
            overlay.IsVisible = true;
            layer.IsVisible = true;
            this.winformsMap1.Overlays.Add(overlay);
            this.winformsMap1.Refresh(overlay);
        }

    }

Hi Torsten,

This is a public forum, please remove your private information.

You can share the data via some public netdisk for example GoogleDrive etc.

And I build a simple sample based on your data: 9324.zip (10.4 KB)

Please put your data into AppData folder in this projection.

it looks the ecw works well:

Please let us know how to reproduce it or upload a modified version.

Regards,

Ethan

Hi Ethan,
I was a few days not in the Office, so sorry for my late answer. The Problem is still present. I modified your sample, so you can see after start the sample, the incorrect Picture.

Regards Torsten

My Code:

public MainWindow()
{
InitializeComponent();
}

    string myDataPath = @"..\..\AppData";
    string ecw_epsg_code_31468 = "Luftbild2008bis2010.ecw";
    ThinkGeo.MapSuite.Shapes.RectangleShape error_extent_31468 =
        new ThinkGeo.MapSuite.Shapes.RectangleShape(4435145.78110358, 5750793.1746165, 4435613.95673077, 5750458.16629144);
    string ecw_epsg_code_25833 = "DOP20RGBI_33384-5884-5924.ecw";
    ThinkGeo.MapSuite.Shapes.RectangleShape error_extent_25833 = 
        new ThinkGeo.MapSuite.Shapes.RectangleShape(384896.590852267,5885173.87435693,385364.766479456,5884838.86603186);
    string ecw_epsg_code_2398 = "Stadtplan_LS150_20150624.ecw";
    ThinkGeo.MapSuite.Shapes.RectangleShape error_extent_2398 =
        new ThinkGeo.MapSuite.Shapes.RectangleShape(4473757.53319361, 5778813.00925322, 4477502.93821113, 5776132.94265268);
    private void map_Loaded(object sender, RoutedEventArgs e)
    {
        map.MapUnit = GeographyUnit.Meter;
        //loadEcw(System.IO.Path.Combine(myDataPath, ecw_epsg_code_25833));
        //loadEcw(System.IO.Path.Combine(myDataPath, ecw_epsg_code_2398));
        //loadEcw(System.IO.Path.Combine(myDataPath, ecw_epsg_code_31468));
        //loadEcwWithExtent(System.IO.Path.Combine(myDataPath, ecw_epsg_code_25833), error_extent_25833);
        loadEcwWithExtent(System.IO.Path.Combine(myDataPath, ecw_epsg_code_2398), error_extent_2398);
        //loadEcwWithExtent(System.IO.Path.Combine(myDataPath, ecw_epsg_code_31468), error_extent_31468);
    }
    void loadEcw(string pathFileName)
    {
        if (!System.IO.File.Exists(pathFileName)) return;
        map.Overlays.Clear();
        EcwRasterLayer layer = new EcwRasterLayer(pathFileName);
        layer.Open();
        if (layer.HasBoundingBox)
        {
            var bb = layer.GetBoundingBox();
            map.CurrentExtent = bb;
        }
        layer.Close();
        LayerOverlay overlay = new LayerOverlay();
        overlay.Layers.Add(layer);
        overlay.IsVisible = true;
        layer.IsVisible = true;
        map.Overlays.Add(overlay);
        map.Refresh(overlay);
    }
    void loadEcwWithExtent(string pathFileName, ThinkGeo.MapSuite.Shapes.RectangleShape extent)
    {
        if (!System.IO.File.Exists(pathFileName)) return;
        map.Overlays.Clear();
        EcwRasterLayer layer = new EcwRasterLayer(pathFileName);
        map.CurrentExtent = extent;
        LayerOverlay overlay = new LayerOverlay();
        overlay.Layers.Add(layer);
        overlay.IsVisible = true;
        layer.IsVisible = true;
        map.Overlays.Add(overlay);
        map.Refresh(overlay);
    }

181126_ecw_drawing_errors.pdf (480.8 KB)

Hi Torsten,

Thanks for your information, I will try to reproduce it.

Any update I will let you know.

Regards,

Ethan

Hi Ethan,
in one of our application’s we use Version 7 from mapsuite. There are no errors with the ecw-files. Now we updated to Version 10.
In january 2019 we will deliver the app to our costumers. So it’s important that the problem will be solved.

Regards
Torsten

Hi Torsten,

Thanks for your information, our developer is working for this problem.

It looks it’s not easy to get solved, any update I will let you know.

Regards,

Ethan

Hi Torsten,

I get the update about this issue, it looks it had been fixed before, but hadn’t get uploaded before test.

Our developer test the fix in high priority today, you can wait this package: https://www.nuget.org/packages/ThinkGeo.MapSuite.Layers.Ecw/11.0.0-beta012 and try it when it’s available.

Any question please let us know.

Regards,

Ethan

Hi Ethan,

today I updated my Projects to Version 10.4 (both Winforms and WPF). I think your developer has fixed the Bugs.
All tested rasterfiles now will draw correctly. Many thanks for your help.
Regards Torsten

Hi Torsten,

Thanks for your update.

Any question please let us know.

Regards,

Ethan