How to fix a GeoTIFF that has an invalid NO DATA value: Difference between revisions
No edit summary |
No edit summary |
||
(28 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
When importing a GeoTIFF into a | When importing a [[GeoTIFF]] into a [[Project]] that you are editing, it can occur that you will receive the following error: | ||
[[File:nodata_tiff_error.PNG| | |||
[[File:nodata_tiff_error.PNG|x300px|left|GeoTIFF error panel shown when importing a GeoTIFF with a {{nodata}}-metadata value that is in ','-number notation.]] | |||
{{clear}} | |||
This error means that the metadata of the GeoTIFF for the {{nodata}} value was written in the ','-number notation, instead of the expected '.'-number notation. | This error means that the metadata of the GeoTIFF for the {{nodata}} value was written in the ','-number notation, instead of the expected '.'-number notation. | ||
Line 6: | Line 8: | ||
It is possible to fix the metadata of a GeoTIFF. You can download the free ''exiftool'' program to automatically adjust the {{nodata}}-metadata. | It is possible to fix the metadata of a GeoTIFF. You can download the free ''exiftool'' program to automatically adjust the {{nodata}}-metadata. | ||
{{editor steps|title=fix a GeoTIFF that has an invalid NO DATA value | |||
{{editor steps|title= | | Download exiftool from https://exiftool.org/. | ||
| Download | |||
| Once downloaded, extract the files and go into the exiftool folder. | | Once downloaded, extract the files and go into the exiftool folder. | ||
| Create a new file and name it a name like " | | Create a new file and name it a name like "nodata.cmd". This will be our automated command file. | ||
| Edit this file with a text editor (such as " | | Edit this file with a text editor (such as "Notepad") | ||
| Paste the code provided below into the text editor and save. | | Paste the code provided below into the text editor and save. | ||
| Drag your GeoTIFF file onto this cmd-file. A command prompt window will open | | Drag your GeoTIFF file onto this cmd-file. A command prompt window will open | ||
| Note that it says that it says it has changed the file. Press enter to continue | | Note that it says that it says it has changed the file. Press enter to continue | ||
| Note that the new | | Note that the new metadata is now printed and verify that the ''GDAL No Data'' value is now correct. | ||
| Try to import your GeoTIFF file into your project. It should no longer show the invalid {{nodata}} error. | | Try to import your GeoTIFF file into your project. It should no longer show the invalid {{nodata}} error. | ||
}} | }} | ||
{{gallery | |||
| nodata_tool_download.PNG|''Exiftool's'' download page. Download the window's zip. | |||
| nodata_tool_extract.PNG|Once downloaded, extract the ''exiftool'' from the zip file. | |||
| nodata_tool_exe.PNG|Folder with the ''exiftool'' and a [[GeoTIFF]] with invalid {{nodata}}. | |||
| nodata_cmd.png|Editing the nodata.cmd file in a text editor | |||
| nodata_drag_on_cmd.png|Dragging a GeoTIFF file onto the nodata.cmd file. | |||
| nodata_value_adjusted.PNG|Command window opening and showing that data has changed. | |||
| nodata_value_printed.PNG|Command window showing the new metadata of the GeoTIFF. | |||
}} | |||
==Nodata.cmd code== | |||
The following code can be used in a cmd-file to automatically adjust the {{nodata}} value of a GeoTIFF and prints the new meta-data values after pressing enter. | |||
<code>exiftool.exe %1 -GDALNoData=-3.4028229999999999999e+038 | |||
pause | |||
pause | |||
exiftool.exe %1 | |||
pause</code> | |||
The %1 refers to the first argument used with our nodata.cmd file; In our case a GeoTIFF-file that you drag onto this cmd-file. | |||
{{article end | {{article end | ||
|notes=* You can also adjust the {{nodata}} value to an other value than -Infinity, for example to -999. | |notes=* You can also adjust the {{nodata}} value to an other value than -Infinity, for example to -999. | ||
|seealso=* [[GeoTIFF]] | |seealso= | ||
*[[GeoTIFF Overlay]] | * [[GeoTIFF]] | ||
* [[GeoTIFF Overlay]] | |||
}} | }} | ||
[[Category:How-to's]] |
Latest revision as of 15:02, 30 January 2024
When importing a GeoTIFF into a Project that you are editing, it can occur that you will receive the following error:
This error means that the metadata of the GeoTIFF for the NO_DATA value was written in the ','-number notation, instead of the expected '.'-number notation.
It is possible to fix the metadata of a GeoTIFF. You can download the free exiftool program to automatically adjust the NO_DATA-metadata.
- Download exiftool from https://exiftool.org/.
- Once downloaded, extract the files and go into the exiftool folder.
- Create a new file and name it a name like "nodata.cmd". This will be our automated command file.
- Edit this file with a text editor (such as "Notepad")
- Paste the code provided below into the text editor and save.
- Drag your GeoTIFF file onto this cmd-file. A command prompt window will open
- Note that it says that it says it has changed the file. Press enter to continue
- Note that the new metadata is now printed and verify that the GDAL No Data value is now correct.
- Try to import your GeoTIFF file into your project. It should no longer show the invalid NO_DATA error.
Nodata.cmd code
The following code can be used in a cmd-file to automatically adjust the NO_DATA value of a GeoTIFF and prints the new meta-data values after pressing enter.
exiftool.exe %1 -GDALNoData=-3.4028229999999999999e+038
pause
exiftool.exe %1
pause
The %1 refers to the first argument used with our nodata.cmd file; In our case a GeoTIFF-file that you drag onto this cmd-file.
Notes
- You can also adjust the NO_DATA value to an other value than -Infinity, for example to -999.