= Instructions to convert a MAP file to other formats = == Convert to FITS == * Use the AltWG toolset to get the proper format {{{ Maplet2FITS --configFile fitsConfig_orex_spc.ini RAD201.MAP RAD201-fullv1.fits }}} * An example ini file can be found here [[attachment:fitsConfig_spc.ini]]. * Notes from Ray Espiritu on 5 May 2020 about the ini file "It may look familiar as it has the same format as the nft config files you send me for generating MLNs. Format is KEYWORD#value. Notice that “//” denotes comment lines. This does not allow you to add custom keywords; the keyword has to exactly match a keyword that is normally populated in the fits header." * There will still be some header information you will want to change. For this use ChangeFitsHeader, also part of the AltWG distribution toolset. * More notes from Ray Espiritu on 5 May 2020 for "This tool allows you to add,delete, or modify keywords in the header. Run “ChangeFitsHeader –examples” to see examples for each operation (add, delete, modify, change). There is a limitation inherent in the fits format in that the new fits header cannot have a size difference of more than 2880 bytes from the old fits header. You shouldn’t encounter that if you are adding or deleting a handful of keywords." == Convert to GeoTIFF == * First, convert to FITS format (and update headers as necessary). * Use GDAL to convert from FITS to GeoTIFF {{{ gdal_translate -b 3 -a_srs RAD201-v5.prj -a_ullr -8510 8510 8510 -8510 RAD201-fullv1.fits RAD201-fullv1.tif }}} * An example of the prj file can be found here, and can be viewed with a text editor such as "vi". [[attachment:RAD201-v5.prj]] * The -a_ullr is giving the bounds of the DTM in meters. The math is "Upperleft X = (Q*2+1) * GSD (in meters) / 2 * -1" and "UpperLeft Y = (Q*2+1) * GSD (in meters) / 2". So if the GSD is 20 m with a Q of 425, the math is (425*2+1) * 20 / 2 * -1 = -8510 * The -a_scale option will tell the geoTiff how to convert the DN value to physical units. I am still working out how to determine the value needed. * If you are converting a fits file with multiple bands, you can specify a particular band with the -b {{{ gdal_translate -a_scale .0023 -a_srs INGV02_jrw.prj -a_ullr -4552.5 4552.5 4552.5 -4552.5 INGV02_DTM.pgm INGV02.tif }}}