[Gdal-dev] ECW and gdal-1.3.1 problem ?

Ivan Mjartan ivan.mjartan at geovap.cz
Mon Jan 2 11:36:32 EST 2006


Hi Frank and all,



Thanks for your help.



After reinstall my Windows and Visual Studio I have problem free ECW SDK 
building from source.



But I have another problem.



So I have followed your instruction



I have downloaded gdalcvs-20060102.zip and build gdal from this source

(i have edited ecw option int opt file)



and everything looks fine till I tried gdal_translate.exe on one ECW file



gdal_translate.exe -of BMP -srcwin 0 0 5001 4001 -outsize 10% 10% 
c:\temp\rastry\bero204.ecw c:\temp\rastry\test.bmp



The result image looks wrong (http://80.188.225.114/temp/ivan/test.bmp)



And the source image is (http://80.188.225.114/temp/ivan/bero204.ecw)



gdal_translate.exe wrote an error ERROR 6: SetColorInterpretation() not 
supported for this dataset



but I have also wrong result if I tried get subwindow in png or tiff format.



So am I doing something wrong ? or bug is in ECW SDK or GDAL ?



Thanks a lot



Ivan



----- Original Message ----- 
From: "Frank Warmerdam" <warmerdam at pobox.com>
To: "Ivan Mjartan" <ivan.mjartan at geovap.cz>
Cc: <gdal-dev at lists.maptools.org>
Sent: Wednesday, December 21, 2005 4:15 PM
Subject: Re: [Gdal-dev] ECW and gdal-1.3.1 problem ?


On 12/21/05, Ivan Mjartan <ivan.mjartan at geovap.cz> wrote:
>
> Hi list
> I tried to build gdal-1.3.1 library with ECW support.
> And I was not successful,
> At first I tried build gdal-1.3.1 with ECW SDK 2.46 but I was also not
> success.  So I download last version of  ECW SDK (3.3).
>
> Then start my C++ horror.
>
> I am not able compile ECW SDK with Visual Studio .Net 2003, a don't know
> why, I followed Build.txt, I downloaded latest Microsoft Platform SDK. And
> when I try build this library a get error
>
> midl : command line error MIDL1004 : cannot execute C preprocessor cl.exe

Ivan,

I haven't run into problems with midl before.

> in the build log is:
>
> NCSEcw : warning PRJ0041 : Cannot find missing dependency 'NCSEcw.tlb' for
> file 'NCSEcw.rc'.  Your project may still build, but may continue to 
> appear
> out of date until this file is found.
> Creating temporary file
> "c:\Projects\Gdal\gdal130\ecw\libecwj2-3.3\Source\C\NCSEcw\NCSEcw\Release\RSP000001.rsp"
> with contents
> [
> /I "..\..\..\include" /I "c:\Program Files\Microsoft Visual Studio .NET
> 2003\Vc7\bin" /env win32 /Oicf  /tlb ".\NCSEcw.tlb" /h "NCSEcwCom.h" /iid
> "NCSEcw_i.c"
> ".\NCSEcw.idl"]Creating command line "midl.exe
> @"c:\Projects\Gdal\gdal130\ecw\libecwj2-3.3\Source\C\NCSEcw\NCSEcw\Release\RSP000001.rsp"
> /nologo"Creating Type Library...Processing .\NCSEcw.idlmidl : command line
> error MIDL1004 : cannot execute C preprocessor cl.exe
>
> What I am doing wrong?
> And another questions Is last ECW SDK and GDAL -1.3.1 compatible?
> Can I get somewhere ECW binary? (I tried new ones from emapper.com) but
> there was not some headers.

To the best of my knowledge ERMapper has not released binaries corresponding
to ECW SDK 3.3RC. GDAL 1.3.1 is ECW SDK 3.3 compatible though you will
need to adjust the build stuff for windows somewhat.

> Or have I wrong Microsoft Platform SDK installed (I tried this PSD-x86.exe
> from
> http://www.microsoft.com/msdownload/platformsdk/sdkupdate)
>
> Or If someone is successful in building last GDAL and Last ECW Could you
> tell me pleas step by step instruction how it is possible ?

I was recently successful in building the ECW SDK 3.3 with
Visual Studio 2002, but I had to convert the 2003 solution back
to do this.  With 2003 it should be more straight forward.

In the particular build, we used /MT instead of /MD for
compatability with the end application in question.  I doubt
this is necessary and in fact it likely complicates things.

For me, aftering installing the latest x86 platform SDK, the build
of the ECW SDK was problem free.   I don't know why you are
running into problems.

But for GDAL there were a number of changes required.  I had to
change the nmake.opt to link against the libecwj2.lib instead of
the old libraries.

eg.
ECWDIR  = C:\warmerda\libecwj2-3.3
ECWLIB  = $(ECWDIR)\Source\NCSBuildQmake\Debug\libecwj2.lib

And in gdal/frmts/ecw/makefile.vc I had to make changes to get all
the same defines as the ECW SDK is built with.  Otherwise you will
suffer "vtable hell".  The makefile now looks like:

EXTRAFLAGS = -I$(ECWDIR)\include -I$(ECWDIR)/Source/include \
/D_MBCS /D_UNICODE /DUNICODE /D_WINDOWS \
/DLIBECWJ2 /DWIN32 /D_WINDLL -DFRMT_ecw -DNO_X86_MMI

OBJ = ecwdataset.obj ecwcreatecopy.obj jp2userbox.obj

GDAL_ROOT = ..\..

!INCLUDE $(GDAL_ROOT)\nmake.opt

default: $(OBJ)
copy *.obj ..\o

all: default testecw.exe

clean:
-del *.obj
-del *.exe


Once these changes were in place, I didn't have any
more problems with the build.

I did recently changes the ecwcreatecopy.cpp code so that it
creates the GeoTIFF for GeoJP2 support myself.  The translation
through the ERMapper "GDT" coordinate system representation
wasn't working too well for me in some cases.

Based on that, I would encourage you to upgrade to the nightly
snapshot of GDAL.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, 
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list