Convert JP2 Data to GeoTIFF with GDAL Scripts


These directions assume that gdal_translate.exe is in the path, or C:\Program Files\GDAL\.
WARNING!
GDAL has five different libraries (Jasper, ERDAS, Kakadu, MrSID, and OpenJPEG) that may be compiled into it for supporting JPEG2000, and does not compile one in by default. Capabilities of the five libraries does vary and can lead to inconsistent results during the conversion process. The directions for obtaining GDAL recommend a version hosted on GISInternals. This version is compiled with the OpenJPEG library and will successfully convert HRO and NAIP - but does generate a large number of error messages and takes a long time. The version of GDAL that comes with FWTools uses the ERDAS library. The ERDAS library is much faster and converts HRO successfully, but will sometimes fail to properly convert the NAIP. OSGeo4W comes with a GDAL library that uses the MrSID library. The MrSID library is fast and successfully converts both NAIP and HRO. The Jasper and Kakadu based libraries have not been tested.
StepDescriptionScreenshot
1Obtain JP2 Data
The primary method for downloading The National Map (TNM) raster JP2 (High Resolution Orthoimagery (HRO) and National Agricultural Imagery Program (NAIP)) type of staged products is by using the TNM Viewer (http://viewer.nationalmap.gov/viewer/). Zoom to the area of interest and then use the download data link at the top (1). Select the data search extent (2), and one or more of the raster staged products (3). This will provide a list of all the products available in that extent. Select the appropriate products and choose next to add them to the shopping cart. Once you checkout an email will be sent with URL's for downloading the staged products.

Use the links provided in the email to download the data, and then unzip (NAIP comes as a JP2 file - no need to unzip) the resulting files on your local computer. More information on downloading data from The National Map is available at http://viewer.nationalmap.gov/help/9.0 TNM Cart Tab.htm
2Obtain USGS Raster Conversion Scripts
A set of scripts for converting raster staged data is available at http://gisdata.usgs.gov/website/USGS_Raster_Conversion_Scripts.zip. These should be downloaded and unzipped locally. (These directions are part of the how to documentation in that archive.)
3aOption 1: Drag and Drop JP2 Download Folder
The GDAL_Convert_All_JP2_2_GeoTIFF.bat script takes a folder name as input and recursively scans that folder for all img files and attempts to create a GeoTIFF for each. In windows explorer when you drag and drop a folder onto a batch file, the folder path is passed as the parameter to run that batch file with. Doing this produces a GeoTIFF in that same folder as the JP2 data. The resulting image(s) will have the name GDAL_JP2_2_GeoTIFF.tif.
3bOption 2: Run the GDAL_JP2_2_GeoTIFF.bat on the command line
The GDAL_JP2_2_GeoTIFF.bat file uses a JP2 file location for the first parameter which is the source to convert. This script will not recursively scan the sub-directories to find the data, so the path must point to the actual JP2 file. A second parameter that is optional allows you to specify the path and name of the output JP2 file.

Since the second parameter is optional, the easiest way to run this is to drag and drop the JP2 file onto the batch file. The directions for using this script are presented below:
USAGE: GDAL_JP2_2_GeoTIFF.bat <JP2 Input File> [Output File Name]
<JP2 Input File>(REQUIRED) This is the relative or full path to the JP2 file that contains the source data.
[Output File Name](OPTIONAL) This is the relative or full path to the output file that will be created. If this is not set, it will attempt to make a sub-folder under the current directory called GeoTIFF_Output, and a file in that folder called GDAL_JP2_2_GeoTIFF.tif.


Accessibility FOIA Privacy Policies and Notices

Take Pride in America logo USA.gov logo U.S. Department of the Interior | U.S. Geological Survey
Page Contact Information: webmapping@usgs.gov
Page Last Modified: September 2015