As the resolution of imagery increases so do file sizes which means it is rather common for us to work with source raster data in a compressed format such as ECW, MrSID or JPEG2000. And while it would be excellent if these compressed formats work as nicely as “native” GeoTIFF imagery files do, that has not been the case for us often. So it is the focus of this edition of the Geospatial Tip of the Month (GTM) to offer a few tips for working with compressed ECW imagery files in ArcGIS.
A little history here for our readers before I jump into this GTM. We had a project in Texas where we were asked to match a newly collected WorldView-2 dataset to an older orthorectified imagery layer from the same location. The goal was to improve the spatial accuracy of the WorldView-2 dataset so that it matched the older dataset which happened to be in compressed ECW format. When we tried to work with the ECW imagery tiles, we quickly hit a road block as the software we typical use for orthorectification would not recognize the ECW files. In fact, only ArcGIS would even load the tiles but they did not have a projection so it was my goal to figure out a work around which is also the topic of this GTM!
Solution 1 – Change the Order in Which You Load Spatial Files
When I tried to load the 50+ ECW tiles given to me by our client, I received the all too common warning in ArcMap about an Unknown Spatial Reference which usually means your data might have coordinates that Arc recognizes but is not exactly sure which projection they refer too. In many cases, this is an easy problem to solve in that you can use the Define Projection toolbox function to set the projection if it is known. The issue with ECW files is that they appear not to hold a projection even if you try to define one, see this Esri blog post as we are not the only ones that faced this.
As a quick side note to this discussion, I have a few theories on why ECW files cannot be projected. First, the GeoTIFF file format has metadata tags inside the file which can be read by spatial software solutions like ArcGIS; and so I would assume ECW files do not have these similar metadata tags that store projection information. Or perhaps, according to the GDAL website, ECW files can only assume “common” projections. A second related theory is that World Files are commonly appended to spatial files where projection information cannot be stored in the metadata, take for example JPEG2000 world files called .J2W. Perhaps ECW world files cannot be created for the simple fact of naming conventions as the file format already ends in a W?
Anyhow, let’s get back to the topic at hand. In the example above, the first thing I did was load the ECW files which did not have a known projection. Now, if I were to load a shapefile, for example, properly set in the same projection as the ECW that intersects the imagery, the current map session would still not have a projection. However, if I were to load the same projected shapefile first and then the unrecognized ECW file, viola, there would be a map projection for the current session and they would line up. This process is called on-the-fly projections and is a topic we have covered in the past here. In a quick sentence, ArcGIS sets the projection of the map session to that of the first file you load, so if the second (and subsequent) files you load are in this same projection, ArcGIS assumes the projections match and the data appears in its correct location. It will not however change the unrecognized but assumed projection of the current map session if an unprojected file, like the ECW here, is loaded first and then a projected shapefile is. This is a pretty simple solution but admittedly it is not actual solving the ECW projection issue.
Solution 2 – Changing the Format of Your ECW File
Okay so the second solution is not very elegant but it is effective as I could not figure out any way to actually project an ECW file. So then the solution is converting your ECW file(s) to a different format, such as a GeoTIFF, and then projecting this file. The best way to do this is with the Mosaic to New Raster toolbox function. In the short Youtube video that accompanies this GTM, I walk you through this process.
As a quick final side note to this discussion, while my focus was on ECW files, I would assume that these “solutions” would work for any compressed imagery format such as JPEG2000 and MrSID with these projection issues.
Do you have an idea for a future GTM? If so, let me know by email at email@example.com.
Brock Adam McCarty