Closed jjimenezshaw closed 3 years ago
use gdal_translate -co COMPRESS=DEFLATE to create a clean file
-88.888 was indeed meant to be the nodata value in this file, as can be seen from the script that created the original grid: https://github.com/NordicGeodesy/NordicTransformations/blob/master/scripts/dnn_grid.py
The nodata value is even declared in the script but maybe the GDAL GTX driver is not aware of the nodata value? Anyway, I'm happy that is is fixed now. Thanks.
@rouault I am running
docker run --rm -v /home:/home osgeo/gdal:alpine-normal-latest /usr/bin/gdal_translate -co COMPRESS=DEFLATE -co TILED=YES -a_nodata -88.888 /home/me/PROJ-data/dk_sdfe/dk_sdfe_dnn.tif /home/me/PROJ-data/dk_sdfe/dk_sdfe_dnn_2.tif
(I added the TILED option) and I get a file of 6 MB, instead of 1.9 MB (the same 6 MB without TILED)
ls -l dk_sdfe/dk_sdfe_dnn*
-rw-r--r-- 1 me me 6291173 Jan 27 14:19 dk_sdfe/dk_sdfe_dnn_2.tif
-rw-r--r-- 1 me me 1919337 Jan 27 14:11 dk_sdfe/dk_sdfe_dnn.tif
I do not know why. Here is the gdalinfo:
Driver: GTiff/GeoTIFF
Files: /home/me/PROJ-data/dk_sdfe/dk_sdfe_dnn_2.tif
Size is 3702, 1651
Coordinate System is:
GEOGCRS["ETRS89",
ENSEMBLE["European Terrestrial Reference System 1989 ensemble",
MEMBER["European Terrestrial Reference Frame 1989"],
MEMBER["European Terrestrial Reference Frame 1990"],
MEMBER["European Terrestrial Reference Frame 1991"],
MEMBER["European Terrestrial Reference Frame 1992"],
MEMBER["European Terrestrial Reference Frame 1993"],
MEMBER["European Terrestrial Reference Frame 1994"],
MEMBER["European Terrestrial Reference Frame 1996"],
MEMBER["European Terrestrial Reference Frame 1997"],
MEMBER["European Terrestrial Reference Frame 2000"],
MEMBER["European Terrestrial Reference Frame 2005"],
MEMBER["European Terrestrial Reference Frame 2014"],
ELLIPSOID["GRS 1980",6378137,298.257222101,
LENGTHUNIT["metre",1]],
ENSEMBLEACCURACY[0.1]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,3],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["ellipsoidal height (h)",up,
ORDER[3],
LENGTHUNIT["metre",1]],
USAGE[
SCOPE["Spatial referencing."],
AREA["Europe - onshore and offshore: Albania; Andorra; Austria; Belgium; Bosnia and Herzegovina; Bulgaria; Croatia; Cyprus; Czechia; Denmark; Estonia; Faroe Islands; Finland; France; Germany; Gibraltar; Greece; Hungary; Ireland; Italy; Kosovo; Latvia; Liechtenstein; Lithuania; Luxembourg; Malta; Moldova; Monaco; Montenegro; Netherlands; North Macedonia; Norway including Svalbard and Jan Mayen; Poland; Portugal; Romania; San Marino; Serbia; Slovakia; Slovenia; Spain; Sweden; Switzerland; United Kingdom (UK) including Channel Islands and Isle of Man; Vatican City State."],
BBOX[32.88,-16.1,84.17,40.18]],
ID["EPSG",4937]]
Data axis to CRS axis mapping: 2,1,3
Origin = (7.900000000000000,57.799999999999990)
Pixel Size = (0.002000000000000,-0.002000000000000)
Metadata:
area_of_use=Denmark
AREA_OR_POINT=Point
target_crs_epsg_code=5733
TIFFTAG_COPYRIGHT=Derived from work by Agency for Data Supply and Efficiency. Creative Commons Attribution 4.0 https://creativecommons.org/licenses/by/4.0/
TIFFTAG_DATETIME=2019:12:27 00:00:00
TIFFTAG_IMAGEDESCRIPTION=ETRS89 (EPSG:4937) to DNN height (EPSG:5733). Converted from dnn.gtx (last modified at 2018/10/05)
TYPE=VERTICAL_OFFSET_GEOGRAPHIC_TO_VERTICAL
Image Structure Metadata:
COMPRESSION=DEFLATE
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 7.9000000, 57.8000000) ( 7d54' 0.00"E, 57d48' 0.00"N)
Lower Left ( 7.9000000, 54.4980000) ( 7d54' 0.00"E, 54d29'52.80"N)
Upper Right ( 15.3040000, 57.8000000) ( 15d18'14.40"E, 57d48' 0.00"N)
Lower Right ( 15.3040000, 54.4980000) ( 15d18'14.40"E, 54d29'52.80"N)
Center ( 11.6020000, 56.1490000) ( 11d36' 7.20"E, 56d 8'56.40"N)
Band 1 Block=256x256 Type=Float32, ColorInterp=Gray
Description = geoid_undulation
NoData Value=-88.88800048828125
Unit Type: metre
Is there anything missing? Is that ok having the file 3 times bigger just setting the nodata value?
BTW, doing a diff between the gdalinfo of both files, the only difference is the line with NoData Value=-88.88800048828125
you should try adding -co PREDICTOR=3 as well
BTW, in no_kv
folder, there are grids with NaN
values in the sea, but without NoData value set. Should we add it? I can do a similar PR as this one.
BTW, in no_kv folder, there are grids with NaN values in the sea, but without NoData value set. Should we add it? I can do a similar PR as this one.
Probably yes, but let's check in with @himsve first
I rebased the changes. The (only) commit now has the tif file generated with gdal_translate
, as the description of the PR says (also updated).
@jjimenezshaw. Such as @kbevers, I also used -88.8888 for empty pixels for the no_kv
files. Feel free to reprocess the files with NoData
if you want. Alternatively, I can fix the files myself.
I have realized that
dk_sdfe_dnn.tif
has some values to -88.888 in the middle of the sea. Looks like a nodata value.The PR is the output of just running this command: