Adding Projection to ECW files ?

Brent Fraser bfraser at GEOANALYTIC.COM
Wed Jun 15 10:20:08 EDT 2005


Bill,

   The spatial reference system is (or at least, can be) stored within the
ECW file.  If you've got access to Windows, you can use ERMapper's ECW
Header Editor tool (available on their download page) to examine the ECW
file header.

   For GDAL to be able to recognize the spatial reference system definition
stored in an ECW file, it needs to be able to locate GDAL's ecw_cs.dat file.
It does this by using the GDAL_DATA environment variable.  For example, mine
(on Windows) is set to

GDAL_DATA=C:\Program Files\FWTools0.9.8\data

The file is included in the GDAL source download, in the data directory.

Brent Fraser


----- Original Message ----- 
From: "Bill Binko" <bill at BINKO.NET>
To: <MAPSERVER-USERS at LISTS.UMN.EDU>
Sent: Wednesday, June 15, 2005 1:15 AM
Subject: [UMN_MAPSERVER-USERS] Adding Projection to ECW files ?


> Hi everyone,
>
> First, enjoy the conference: this can wait, but I wanted to ask while it
> was fresh.  Wish I could join you.
>
> I have had some recent success with my raster project...
>
> 1) I have gotten GDAL & ECW to work on Linux (bug in ECW)
>
> 2) I have gotten gdaltindex to generate a tileindex of my DOQQs
>
> 3) I have gotten Mapserver to show my images (YAY) if I set the projection
> to UTM Zone 17N in the mapfile
>
> The problem is that the ECW files don't seem to have the UTM 17N
> associated with them in any metadata that GDAL reads.  They come with
> .aux, .ecw, .ecw.xml, .ecw.aux.xml, and .html files for each image.
>
> Now, when I run gdalinfo on the file, I get this:
>
> [bill at fastcat ecw_rgb]$ gdalinfo dq4517ne.ecw
> Driver: ECW/ERMapper Compressed Wavelets
> Size is 6199, 7064
> Coordinate System is:
> LOCAL_CS["LOCAL",
>     UNIT["Meter",1]]
> Origin = (397031.442000,3277747.800000)
> Pixel Size = (1.00000000,-1.00000000)
> Corner Coordinates:
> Upper Left  (  397031.442, 3277747.800)
> Lower Left  (  397031.442, 3270683.800)
> Upper Right (  403230.442, 3277747.800)
> Lower Right (  403230.442, 3270683.800)
> Center      (  400130.942, 3274215.800)
> Band 1 Block=6199x1 Type=Byte, ColorInterp=Red
>   Overviews: arbitrary
> Band 2 Block=6199x1 Type=Byte, ColorInterp=Green
>   Overviews: arbitrary
> Band 3 Block=6199x1 Type=Byte, ColorInterp=Blue
>   Overviews: arbitrary
>
> So, I know that it has the boundary info, and I don't need separate .tfw
> (or equivalent).  However, notice the LOCAL_CS -- it didn't find the
> projection information.
>
> Is there any way I can add this to the files?  It should be the same for
> all of them.
>
> Without it, gdal_merge.py blows up, and I can't create summary images :(
>
> I know this is long winded, but can anyone help?
>
> Thanks
> Bill



More information about the mapserver-users mailing list