Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4635 closed defect (invalid)

Georeferencing problem with ECW + XML from ArcGis

Reported by: sylvainm Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: 1.8.1
Severity: normal Keywords: ECW, XML
Cc:

Description

(excuse me, i am french and don't speak english very well...)

My ECW raster come from ArcGis and are associated with .AUX.XML files (created by ArcGis). It seems that this xml files cause QGis bug because ECW are not correctly georeferenced (top left corner is [0;0]). Instead, ECW header are correct.

I have shown this XML file to ArcGis user, ans they said to me this XML is not wrong (personnaly, i can't understand this !).

In attachement, i send you the XML file.

Attachments (1)

61-2001-0360-2395-LA2E-C10.ecw.aux.xml (672 bytes ) - added by sylvainm 12 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Even Rouault, 12 years ago

Resolution: fixed
Status: newclosed

Indeed I used that .ecw.aux.xml with a properly georeferenced .ecw, and I've seen that with GDAL 1.7, this has the effect to invalidate the geotransform of the .ecw. But with GDAL >= 1.8, the geotransform from the .ecw is preserved, and the SRS from the .ecw.aux.xml is used as expected. So the solution is to upgrade the GDAL version.

Bad :

even@even-desktop:~/gdal/svn/1.7/gdal$ gdalinfo ../../trunk/gdal/byte.ecw
Driver: ECW/ERMapper Compressed Wavelets
Files: ../../trunk/gdal/byte.ecw
       ../../trunk/gdal/byte.ecw.aux.xml
Size is 1280, 1280
Coordinate System is:
PROJCS["NTF_France_II_degrees",
    GEOGCS["GCS_NTF",
        DATUM["Nouvelle_Triangulation_Francaise",
            SPHEROID["Clarke_1880_IGN",6378249.2,293.46602]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Lambert_Conformal_Conic_1SP"],
    PARAMETER["False_Easting",600000.0],
    PARAMETER["False_Northing",2200000.0],
    PARAMETER["Central_Meridian",2.337229166666667],
    PARAMETER["Standard_Parallel_1",46.8],
    PARAMETER["Scale_Factor",0.99987742],
    PARAMETER["Latitude_Of_Origin",46.8],
    UNIT["Meter",1.0]]
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 1280.0)
Upper Right ( 1280.0,    0.0)
Lower Right ( 1280.0, 1280.0)
Center      (  640.0,  640.0)
Band 1 Block=1280x1 Type=Byte, ColorInterp=Gray
  Overviews: arbitrary

Good :

even@even-desktop:~/gdal/svn/1.8/gdal$ gdalinfo ../../trunk/gdal/byte.ecw
Driver: ECW/ERDAS Compressed Wavelets (SDK 3.x)
Files: ../../trunk/gdal/byte.ecw
       ../../trunk/gdal/byte.ecw.aux.xml
Size is 1280, 1280
Coordinate System is:
PROJCS["NTF_France_II_degrees",
    GEOGCS["GCS_NTF",
        DATUM["Nouvelle_Triangulation_Francaise",
            SPHEROID["Clarke_1880_IGN",6378249.2,293.46602]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Lambert_Conformal_Conic_1SP"],
    PARAMETER["False_Easting",600000.0],
    PARAMETER["False_Northing",2200000.0],
    PARAMETER["Central_Meridian",2.337229166666667],
    PARAMETER["Standard_Parallel_1",46.8],
    PARAMETER["Scale_Factor",0.99987742],
    PARAMETER["Latitude_Of_Origin",46.8],
    UNIT["Meter",1.0]]
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (0.937500000000000,-0.937500000000000)
Corner Coordinates:
Upper Left  (  440720.000, 3751320.000) (  0d28'33.20"W, 60d34'10.71"N)
Lower Left  (  440720.000, 3750120.000) (  0d28'30.47"W, 60d33'33.19"N)
Upper Right (  441920.000, 3751320.000) (  0d27'16.97"W, 60d34'12.05"N)
Lower Right (  441920.000, 3750120.000) (  0d27'14.26"W, 60d33'34.53"N)
Center      (  441320.000, 3750720.000) (  0d27'53.73"W, 60d33'52.62"N)
Band 1 Block=1280x1 Type=Byte, ColorInterp=Gray
  Overviews: 640x640, 320x320, 160x160

and

even@even-desktop:~/gdal/svn/1.9/gdal$ gdalinfo ../../trunk/gdal/byte.ecw
Driver: ECW/ERDAS Compressed Wavelets (SDK 3.x)
Files: ../../trunk/gdal/byte.ecw
       ../../trunk/gdal/byte.ecw.aux.xml
Size is 1280, 1280
Coordinate System is:
PROJCS["NTF_France_II_degrees",
    GEOGCS["GCS_NTF",
        DATUM["Nouvelle_Triangulation_Francaise",
            SPHEROID["Clarke_1880_IGN",6378249.2,293.46602]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Lambert_Conformal_Conic_1SP"],
    PARAMETER["False_Easting",600000.0],
    PARAMETER["False_Northing",2200000.0],
    PARAMETER["Central_Meridian",2.337229166666667],
    PARAMETER["Standard_Parallel_1",46.8],
    PARAMETER["Scale_Factor",0.99987742],
    PARAMETER["Latitude_Of_Origin",46.8],
    UNIT["Meter",1.0]]
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (0.937500000000000,-0.937500000000000)
Corner Coordinates:
Upper Left  (  440720.000, 3751320.000) (  0d28'33.20"W, 60d34'10.71"N)
Lower Left  (  440720.000, 3750120.000) (  0d28'30.47"W, 60d33'33.19"N)
Upper Right (  441920.000, 3751320.000) (  0d27'16.97"W, 60d34'12.05"N)
Lower Right (  441920.000, 3750120.000) (  0d27'14.26"W, 60d33'34.53"N)
Center      (  441320.000, 3750720.000) (  0d27'53.73"W, 60d33'52.62"N)
Band 1 Block=1280x1 Type=Byte, ColorInterp=Gray
  Overviews: 640x640, 320x320, 160x160

comment:2 by sylvainm, 12 years ago

Resolution: fixed
Status: closedreopened
Version: 1.7.31.8.1

Thank you for your help,

with GDAL >= 1.8, the geotransform from the .ecw is preserved, and the SRS from the .ecw.aux.xml is used as expected

However, my ECW files are opened in QGIS 1.7.4 Wroclaw, with GDAL/OGR 1.8.1 (this is what i see when i go to the "About" menu, in QGis) Is it possible that my GADL is not updated ? How can i update GDAL into QGis ?

Thank you in advance (and excuse me for my bad english)

Sylvain

comment:3 by Even Rouault, 12 years ago

(Eh, you can stop excusing yourself about your English : I'm a French native speaker too ;-))

It might be something particular with your ECW file. Providing a link to it for examination would be usefull. You can also test with gdalinfo on the command line on your side. (Not sure if QGIS standalone binaries are provided with the GDAL command line utilities though)

Did you try with OSGeo4W that now has GDAL 1.9.0 ?

comment:4 by sylvainm, 12 years ago

Merci alors collègue ! But I must make an effort in this English-speaking community. So I filed one of ECW and its auxiliary files to this address : http://dl.free.fr/mEMs7Wr6B (Free serveur) This one comes, as the majority of my ECW, from IGN (BD-Ortho Product). The only change compared to the original files is the coordinate system definition in ArcGIS, which generates the AUX.XML file. Thank you again for looking at my problem (and tell me if I'm allowed to speak French : I may be better understood!)

Results of gdalinfo :

  • without the AUX.XML file (seems to be ok) :
    C:\Program Files\FWTools2.4.7>gdalinfo E:\61-2006\61-2006-0425-6845-LA93-C07.ecw
    
    Driver: ECW/ERMapper Compressed Wavelets
    Files: E:\61-2006\61-2006-0425-6845-LA93-C07.ecw
    Size is 10000, 10000
    Coordinate System is:
    PROJCS["LMFRAN93",
        GEOGCS["FRANCE 1993",
            DATUM["RGF93",
                SPHEROID["GRS80",6378137,298.257222101]],
            PRIMEM["Greenwich",0],
            UNIT["degree",0.0174532925199433]],
        PROJECTION["Lambert_Conformal_Conic_2SP"],
        PARAMETER["standard_parallel_1",44],
        PARAMETER["standard_parallel_2",48.99999999999876],
        PARAMETER["latitude_of_origin",46.49999999999998],
        PARAMETER["central_meridian",3.000000000009746],
        PARAMETER["false_easting",700000],
        PARAMETER["false_northing",6600000],
        UNIT["Meter",1]]
    Origin = (425000.000000000000000,6845000.000000000000000)
    Pixel Size = (0.500000000000000,-0.500000000000000)
    Corner Coordinates:
    Upper Left  (  425000.000, 6845000.000) (  0d44'3.43"W, 48d38'47.91"N)
    Lower Left  (  425000.000, 6840000.000) (  0d43'51.89"W, 48d36'6.18"N)
    Upper Right (  430000.000, 6845000.000) (  0d39'59.36"W, 48d38'55.50"N)
    Lower Right (  430000.000, 6840000.000) (  0d39'48.03"W, 48d36'13.76"N)
    Center      (  427500.000, 6842500.000) (  0d41'55.68"W, 48d37'30.86"N)
    Band 1 Block=10000x1 Type=Byte, ColorInterp=Red
      Overviews: arbitrary
    Band 2 Block=10000x1 Type=Byte, ColorInterp=Green
      Overviews: arbitrary
    Band 3 Block=10000x1 Type=Byte, ColorInterp=Blue
      Overviews: arbitrary
    
  • with the AUX.XML file (bad)
    C:\Program Files\FWTools2.4.7>gdalinfo E:\61-2006\61-2006-0425-6845-LA93-C07.ecw
    
    Driver: ECW/ERMapper Compressed Wavelets
    Files: E:\61-2006\61-2006-0425-6845-LA93-C07.ecw
           E:\61-2006\61-2006-0425-6845-LA93-C07.ecw.aux.xml
    Size is 10000, 10000
    Coordinate System is:
    PROJCS["RGF93_Lambert_93",
        GEOGCS["GCS_RGF_1993",
            DATUM["RGF_1993",
                SPHEROID["GRS_1980",6378137.0,298.257222101]],
            PRIMEM["Greenwich",0.0],
            UNIT["Degree",0.0174532925199433]],
        PROJECTION["Lambert_Conformal_Conic_2SP"],
        PARAMETER["False_Easting",700000.0],
        PARAMETER["False_Northing",6600000.0],
        PARAMETER["Central_Meridian",3.0],
        PARAMETER["Standard_Parallel_1",44.0],
        PARAMETER["Standard_Parallel_2",49.0],
        PARAMETER["Latitude_Of_Origin",46.5],
        UNIT["Meter",1.0]]
    Corner Coordinates:
    Upper Left  (    0.0,    0.0)
    Lower Left  (    0.0,10000.0)
    Upper Right (10000.0,    0.0)
    Lower Right (10000.0,10000.0)
    Center      ( 5000.0, 5000.0)
    Band 1 Block=10000x1 Type=Byte, ColorInterp=Red
      Overviews: arbitrary
    Band 2 Block=10000x1 Type=Byte, ColorInterp=Green
      Overviews: arbitrary
    Band 3 Block=10000x1 Type=Byte, ColorInterp=Blue
      Overviews: arbitrary
    

comment:5 by Even Rouault, 12 years ago

Resolution: invalid
Status: reopenedclosed

In fact, this ticket is a duplicate of #4131, which was fixed in GDAL 1.8.1

Ignore FWTools 2.4.XX : it is obsolete software distribution, no longer maintained.

I've downloaded you sample dataset and tested it with my own build of GDAL 1.8.1, and cannot reproduce the issue you observe. I've also downloaded QGIS 1.7.4 (Standalone) from the qgis website, and I reproduce your bug. The interesting thing is that it is also GDAL 1.8.1...

My conclusion : the QGIS binary distribution ships the binary of GDAL 1.8.1 for the GDAL core DLL (gdal18.dll), but the plugins like ECW have not been rebuilt, so I assume they are in the state of their initial introduction, that is to say GDAL 1.8.0. This is the only logical explanation.

So this is a QGIS packaging "bug", which is probably originally a OSGeo4W one. At the time GDAL 1.8.1 was pushed in OSGeo4W, the plugins that had been pushed initially for 1.8.0 should also have been refreshed. This came largely unnoticed because there is binary compatibility between GDAL 1.8.0 and 1.8.1 as far as plugins are concerned...

Hope this makes sense...

comment:6 by Even Rouault, 12 years ago

Ok, I've a definitive proof of my guess. I've opened the gdal_ECW_JP2ECW.dll and found the following string in it "Id: ecwdataset.cpp 21593 2011-01-27 19:13:13Z warmerdam". So the revision of ecwdataset.cpp in qgis 1.7.4 standalone is r21593, which interestingly is an intermediate point in the GDAL 1.8 branch, between official 1.8.0 and official 1.8.1... The fix for #4131 was pushed in r22589, later than r21593.

Note: See TracTickets for help on using tickets.