Cannot see .ecw file type in GDAL rasters with v1.6.0

Jan 17, 2014 at 4:57 AM
I don't see .ecw file types in the list of GDAL rasters in the file dialog selection. Am I missing something?
Developer
Jan 17, 2014 at 4:52 PM
Hi, yes i see that such file type not exists inside dialog selection filter. But did you tried to load .ecw file with "All files" filter? Any luck in this? It should work as we have gdal_ECW_JP2ECW.dll (ecw gdal plugin) inside gdal plugins folder. But i can't test it now because i have no .ecw files.
Jan 18, 2014 at 1:47 AM
Oops... didn't think to try that. Duh!
Oddly, though, I can drag an ecw into the map and it displays OK but when I try to select and open from the dialog (map1.AdddRasterLayer(); using the All files filter) nothing happens.

btw, we publish ecw files regularly on our site at http://www.dmp.wa.gov.au/14582.aspx
Here is a direct url to one set (zipped) from this page.... http://www.dmp.wa.gov.au/documents/PrinceRegent-MontagueSound_2011_P1236_merge_Images_2012-10-25.zip
Developer
Jan 18, 2014 at 7:18 AM
Just tried it with latest DemoMap application - .ecw can be loaded through menu "Add Layer..." with any of this filter: Images, GDAL-Images, All Supported Formats.
And drag to map also works fine.
If you want to add these files programmaticaly - call map.AddLayers() instead AddRasterLayer(), because in fact these files will be loaded into IImageData interface, not into IRaster.
Marked as answer by jany_ on 9/10/2014 at 1:15 PM
Jan 18, 2014 at 8:04 AM
That did it. Thank you very much.
Jan 23, 2014 at 4:10 AM
One more question... although this is not strictly a DotSpatial issue but a basic lack of knowledge of Visual Studio ...

By putting the Windows Extensions directory and subordinate GDAL folders into the Debug folder (as per
Mudnug's tutorial
I can see all the GDAL types when I run in Visual Studio. But these are not visible when I publish the solution because they are not in the project only in the file manager.

How do I include the Windows Extensions folder and contents in the project when I build and publish?
Developer
Jan 23, 2014 at 9:39 AM
Please note, that Mudnug's tutorial regarding GDAL extension a bit is out of date: from 1.6 version you not need to compile DotSpatial.Data.Rasters.GdalExtension into x86 or x64 - enougth AnyCPU mode. If you want to have all GDALs dlls in your output folder you could to create postbuild event which copies all dlls into that output folder.
Jan 23, 2014 at 9:47 AM
Thank you for the response, mogikanin. However, my problem is that I am a Visual Studio dummy. :(
I will look up how to do postbuild events and have the output folder packaged into the setup.exe.
Jan 29, 2014 at 10:31 PM
I'm afraid that I am getting nowhere with this.

Please, can you post a "Peter and Jane" level description of how to do a one-click publish of a basic DotSpatial solution (i.e. map1 + appManager1 + button1 > map1.AddLayers(); ) that will include all the GDAL formats in the FileDialog when the published program is installed and run?

Many thanks.
Developer
Jan 30, 2014 at 6:29 AM
Jan 31, 2014 at 1:30 AM
I really appreciate the time you are taking on this for me.

I'm still getting the same behaviour: GDAL formats accessible when app runs in the (VS2012) IDE; not when run as installed app from published setup.exe.

I've compiled this detailed blow-by-blow log (MS Word docx) of what I am doing. Perhaps it will help to identify what I am doing wrong or what I am not doing that I should be. If I can get this sorted, I'll write it up as a "Tutorial for complete idiots" in case I'm not the only one.

Thanks again.
Editor
Jan 31, 2014 at 6:42 AM
Could you post the directory structure of both your VS build output and the one created by setup?
Jan 31, 2014 at 8:23 AM
Edited Jan 31, 2014 at 8:28 AM
Images at http://private.shdhoward.com/dotspatial/
  1. Post-publish project dir structure
  2. Published dir root (containing setup.exe)
  3. Published dir Application Files subdir. Note that there are no GDAL extensions here.
  4. Installed application shortcut path after installation. I've never been able to locate where a click-once app is installed on C:\ (in Win 7 or Win 8). It appears in the Control Panel list of programs but the properties path only leads to the shortcut.
This set of images is on my personal Windows 8 machine. The images in the previous word doc are from a Windows 7 machine. The structures are the same in both,
Developer
Jan 31, 2014 at 8:55 AM
http://stackoverflow.com/questions/3137880/how-to-get-visual-studio-publish-functionality-to-include-files-from-post-buil
Just for interest, why you are needed this "publish" stuff? The better will be using any installer, e.g. wix.
Jan 31, 2014 at 9:12 AM
Edited Jan 31, 2014 at 2:31 PM
I think I've seen that answer. It focuses on a web deployment.

Short answer: because I don't know any better. The VS click-once is very simple; literally one-click and I don't have to worry about the build/deploy process. . I'll download wix and give it a shot.
Jan 31, 2014 at 10:41 PM
Edited Feb 1, 2014 at 12:15 AM
Apparently Wix does not integrate into VS Express editions (which I have at home) so not easy to test.
There are work-arounds for VS Express and Wix that I will try to use.
Feb 2, 2014 at 6:34 AM
I couldn't work out how to use Wix with VS Express, However I have made a setup.exe using Inno Setup and its scripting wizard to copy the VS build output folder (with all the DS dlls and the Windows Extensions directory and contents. Running the setup.exe installed the program under C:\Program Files (x86) and the GDAL formats were all visible (and the ecw loadable) in the app when launched.

Thank you very much for the guidance.