PNG driver chokes on raster gdal_transformed to ot byteTilecache positions my gdal_translated map 20km south of where I want itVSIMalloc3() and UnifiedSrcDensity mask errors when running gdal_warp in OSGEO4w shellgdal2tiles tile origin differences using Windows/OSGeo4W and Linux/GDALConvert grey,green,blue to red,green,blue tiffGetting origin as long, lat in GDAL without knowing EPSGCan gdalwarp reproject from ESPG:4326 (WGS84) to UTM?gdal_translate - raw to png?Transforming Lambert Conformal Conic to EPSG:3857Projecting EUMETSAT precipitation dataosgeo.gdal.Translate - How to set compression on GDAL GTiff driver

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?

Which models of the Boeing 737 are still in production?

Today is the Center

Why don't electron-positron collisions release infinite energy?

How can bays and straits be determined in a procedurally generated map?

The use of multiple foreign keys on same column in SQL Server

Prove that NP is closed under karp reduction?

Why doesn't H₄O²⁺ exist?

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

Have astronauts in space suits ever taken selfies? If so, how?

Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)

strToHex ( string to its hex representation as string)

Languages that we cannot (dis)prove to be Context-Free

Maximum likelihood parameters deviate from posterior distributions

To string or not to string

TGV timetables / schedules?

Dragon forelimb placement

Modeling an IPv4 Address

What's the point of deactivating Num Lock on login screens?

How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?

In Japanese, what’s the difference between “Tonari ni” (となりに) and “Tsugi” (つぎ)? When would you use one over the other?

Why does Kotter return in Welcome Back Kotter?

Writing rule stating superpower from different root cause is bad writing

How to write a macro that is braces sensitive?



PNG driver chokes on raster gdal_transformed to ot byte


Tilecache positions my gdal_translated map 20km south of where I want itVSIMalloc3() and UnifiedSrcDensity mask errors when running gdal_warp in OSGEO4w shellgdal2tiles tile origin differences using Windows/OSGeo4W and Linux/GDALConvert grey,green,blue to red,green,blue tiffGetting origin as long, lat in GDAL without knowing EPSGCan gdalwarp reproject from ESPG:4326 (WGS84) to UTM?gdal_translate - raw to png?Transforming Lambert Conformal Conic to EPSG:3857Projecting EUMETSAT precipitation dataosgeo.gdal.Translate - How to set compression on GDAL GTiff driver






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I'd like to extract a part of a DEM (data.linz.govt.nz wellinton lidar dem) and analyse it using gdaldem:



$ gdalinfo /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif 
Driver: GTiff/GeoTIFF
Files: /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif
Size is 40827, 59684
Coordinate System is:
PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
GEOGCS["NZGD2000",
DATUM["New_Zealand_Geodetic_Datum_2000",
SPHEROID["GRS 1980",6378137,298.2572221010002,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6167"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4167"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",173],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",1600000],
PARAMETER["false_northing",10000000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","2193"]]
Origin = (1079625.000000000000000,6229400.000000000000000)
Pixel Size = (25.000000000000000,-25.000000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 1079625.000, 6229400.000) (167d22'19.08"E, 33d56'49.88"S)
Lower Left ( 1079625.000, 4737300.000) (166d 6'50.17"E, 47d18'37.53"S)
Upper Right ( 2100300.000, 6229400.000) (178d24'42.42"E, 33d57'24.89"S)
Lower Right ( 2100300.000, 4737300.000) (179d37'20.18"E, 47d19'33.76"S)
Center ( 1589962.500, 5483350.000) (172d52'51.63"E, 40d48' 2.84"S)
Band 1 Block=256x256 Type=Int16, ColorInterp=Gray
NoData Value=-32768
Metadata:
LAYER_TYPE=athematic


That my source.



$ gdal_translate -q -scale -ot Byte -a_nodata 0 -of GTiff -projwin 1744670.939733, 5432632.999810, 1759079.145998, 5417666.249587 -outsize 256 256 /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b


I tried all combinations, with or without scale, ot and a_nodata.



$ gdalinfo /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b
Driver: GTiff/GeoTIFF
Files: /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b
Size is 256, 256
Coordinate System is:
PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
GEOGCS["NZGD2000",
DATUM["New_Zealand_Geodetic_Datum_2000",
SPHEROID["GRS 1980",6378137,298.2572221010002,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6167"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4167"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",173],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",1600000],
PARAMETER["false_northing",10000000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","2193"]]
Origin = (1744650.000000000000000,5432650.000000000000000)
Pixel Size = (56.250000000000000,-58.496093750000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 1744650.000, 5432650.000) (174d43'34.71"E, 41d14'40.64"S)
Lower Left ( 1744650.000, 5417675.000) (174d43'47.53"E, 41d22'46.03"S)
Upper Right ( 1759050.000, 5432650.000) (174d53'53.08"E, 41d14'30.91"S)
Lower Right ( 1759050.000, 5417675.000) (174d54' 7.18"E, 41d22'36.25"S)
Center ( 1751850.000, 5425162.500) (174d48'50.62"E, 41d18'38.57"S)
Band 1 Block=256x32 Type=Byte, ColorInterp=Gray
NoData Value=0
Metadata:
LAYER_TYPE=athematic


gdaldem hillshade works but not slope or any of the other modes:



$ gdaldem slope /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b /dev/stdout -q -of PNG


returns the error:



ERROR 6: PNG driver doesn't support data type Float32. Only eight bit (Byte) and sixteen bit (UInt16) bands supported.


How do I translate the original raster so that conforms with what gdaldem slope and co expect?










share|improve this question









New contributor




adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 2





    Think what the error message says and don't try to create png but create a GeoTIFF instead with -ot GTiff. In the first clipping command leave out -ot Byte. You should not convert DEM into 8 bit.

    – user30184
    Apr 3 at 5:10












  • Your gdaldem slope needs to be output to a format that does support floating point data, like GeoTIFF (-of GTIFF) or ERDAS Imagine (-of HFA) or the lowest form ASCII Grid (-of AAIGRID).. you have told it to output to a PNG which only supports 8 bit unsigned so gdaldem is refusing to write to this driver. Why are you trying to scale your DEM to 8 bit? It should be at least 16 bit integer, most likely 32 bit float or 64 bit float (double), scaling to 8 bit is not fit for any further processing but for display only.

    – Michael Stimson
    Apr 3 at 5:16












  • The idea is to generate a 256*256 PNG map tile to use with leaflet.

    – adminopasswordo
    Apr 3 at 6:13











  • Is my problem that the input from the translation contains data that is neither byte nor UInt16 or that gdaldem cannot do slopes in PNG? Again hillshade works, just not the others.

    – adminopasswordo
    Apr 3 at 7:06

















1















I'd like to extract a part of a DEM (data.linz.govt.nz wellinton lidar dem) and analyse it using gdaldem:



$ gdalinfo /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif 
Driver: GTiff/GeoTIFF
Files: /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif
Size is 40827, 59684
Coordinate System is:
PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
GEOGCS["NZGD2000",
DATUM["New_Zealand_Geodetic_Datum_2000",
SPHEROID["GRS 1980",6378137,298.2572221010002,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6167"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4167"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",173],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",1600000],
PARAMETER["false_northing",10000000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","2193"]]
Origin = (1079625.000000000000000,6229400.000000000000000)
Pixel Size = (25.000000000000000,-25.000000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 1079625.000, 6229400.000) (167d22'19.08"E, 33d56'49.88"S)
Lower Left ( 1079625.000, 4737300.000) (166d 6'50.17"E, 47d18'37.53"S)
Upper Right ( 2100300.000, 6229400.000) (178d24'42.42"E, 33d57'24.89"S)
Lower Right ( 2100300.000, 4737300.000) (179d37'20.18"E, 47d19'33.76"S)
Center ( 1589962.500, 5483350.000) (172d52'51.63"E, 40d48' 2.84"S)
Band 1 Block=256x256 Type=Int16, ColorInterp=Gray
NoData Value=-32768
Metadata:
LAYER_TYPE=athematic


That my source.



$ gdal_translate -q -scale -ot Byte -a_nodata 0 -of GTiff -projwin 1744670.939733, 5432632.999810, 1759079.145998, 5417666.249587 -outsize 256 256 /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b


I tried all combinations, with or without scale, ot and a_nodata.



$ gdalinfo /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b
Driver: GTiff/GeoTIFF
Files: /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b
Size is 256, 256
Coordinate System is:
PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
GEOGCS["NZGD2000",
DATUM["New_Zealand_Geodetic_Datum_2000",
SPHEROID["GRS 1980",6378137,298.2572221010002,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6167"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4167"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",173],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",1600000],
PARAMETER["false_northing",10000000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","2193"]]
Origin = (1744650.000000000000000,5432650.000000000000000)
Pixel Size = (56.250000000000000,-58.496093750000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 1744650.000, 5432650.000) (174d43'34.71"E, 41d14'40.64"S)
Lower Left ( 1744650.000, 5417675.000) (174d43'47.53"E, 41d22'46.03"S)
Upper Right ( 1759050.000, 5432650.000) (174d53'53.08"E, 41d14'30.91"S)
Lower Right ( 1759050.000, 5417675.000) (174d54' 7.18"E, 41d22'36.25"S)
Center ( 1751850.000, 5425162.500) (174d48'50.62"E, 41d18'38.57"S)
Band 1 Block=256x32 Type=Byte, ColorInterp=Gray
NoData Value=0
Metadata:
LAYER_TYPE=athematic


gdaldem hillshade works but not slope or any of the other modes:



$ gdaldem slope /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b /dev/stdout -q -of PNG


returns the error:



ERROR 6: PNG driver doesn't support data type Float32. Only eight bit (Byte) and sixteen bit (UInt16) bands supported.


How do I translate the original raster so that conforms with what gdaldem slope and co expect?










share|improve this question









New contributor




adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 2





    Think what the error message says and don't try to create png but create a GeoTIFF instead with -ot GTiff. In the first clipping command leave out -ot Byte. You should not convert DEM into 8 bit.

    – user30184
    Apr 3 at 5:10












  • Your gdaldem slope needs to be output to a format that does support floating point data, like GeoTIFF (-of GTIFF) or ERDAS Imagine (-of HFA) or the lowest form ASCII Grid (-of AAIGRID).. you have told it to output to a PNG which only supports 8 bit unsigned so gdaldem is refusing to write to this driver. Why are you trying to scale your DEM to 8 bit? It should be at least 16 bit integer, most likely 32 bit float or 64 bit float (double), scaling to 8 bit is not fit for any further processing but for display only.

    – Michael Stimson
    Apr 3 at 5:16












  • The idea is to generate a 256*256 PNG map tile to use with leaflet.

    – adminopasswordo
    Apr 3 at 6:13











  • Is my problem that the input from the translation contains data that is neither byte nor UInt16 or that gdaldem cannot do slopes in PNG? Again hillshade works, just not the others.

    – adminopasswordo
    Apr 3 at 7:06













1












1








1








I'd like to extract a part of a DEM (data.linz.govt.nz wellinton lidar dem) and analyse it using gdaldem:



$ gdalinfo /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif 
Driver: GTiff/GeoTIFF
Files: /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif
Size is 40827, 59684
Coordinate System is:
PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
GEOGCS["NZGD2000",
DATUM["New_Zealand_Geodetic_Datum_2000",
SPHEROID["GRS 1980",6378137,298.2572221010002,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6167"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4167"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",173],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",1600000],
PARAMETER["false_northing",10000000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","2193"]]
Origin = (1079625.000000000000000,6229400.000000000000000)
Pixel Size = (25.000000000000000,-25.000000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 1079625.000, 6229400.000) (167d22'19.08"E, 33d56'49.88"S)
Lower Left ( 1079625.000, 4737300.000) (166d 6'50.17"E, 47d18'37.53"S)
Upper Right ( 2100300.000, 6229400.000) (178d24'42.42"E, 33d57'24.89"S)
Lower Right ( 2100300.000, 4737300.000) (179d37'20.18"E, 47d19'33.76"S)
Center ( 1589962.500, 5483350.000) (172d52'51.63"E, 40d48' 2.84"S)
Band 1 Block=256x256 Type=Int16, ColorInterp=Gray
NoData Value=-32768
Metadata:
LAYER_TYPE=athematic


That my source.



$ gdal_translate -q -scale -ot Byte -a_nodata 0 -of GTiff -projwin 1744670.939733, 5432632.999810, 1759079.145998, 5417666.249587 -outsize 256 256 /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b


I tried all combinations, with or without scale, ot and a_nodata.



$ gdalinfo /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b
Driver: GTiff/GeoTIFF
Files: /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b
Size is 256, 256
Coordinate System is:
PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
GEOGCS["NZGD2000",
DATUM["New_Zealand_Geodetic_Datum_2000",
SPHEROID["GRS 1980",6378137,298.2572221010002,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6167"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4167"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",173],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",1600000],
PARAMETER["false_northing",10000000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","2193"]]
Origin = (1744650.000000000000000,5432650.000000000000000)
Pixel Size = (56.250000000000000,-58.496093750000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 1744650.000, 5432650.000) (174d43'34.71"E, 41d14'40.64"S)
Lower Left ( 1744650.000, 5417675.000) (174d43'47.53"E, 41d22'46.03"S)
Upper Right ( 1759050.000, 5432650.000) (174d53'53.08"E, 41d14'30.91"S)
Lower Right ( 1759050.000, 5417675.000) (174d54' 7.18"E, 41d22'36.25"S)
Center ( 1751850.000, 5425162.500) (174d48'50.62"E, 41d18'38.57"S)
Band 1 Block=256x32 Type=Byte, ColorInterp=Gray
NoData Value=0
Metadata:
LAYER_TYPE=athematic


gdaldem hillshade works but not slope or any of the other modes:



$ gdaldem slope /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b /dev/stdout -q -of PNG


returns the error:



ERROR 6: PNG driver doesn't support data type Float32. Only eight bit (Byte) and sixteen bit (UInt16) bands supported.


How do I translate the original raster so that conforms with what gdaldem slope and co expect?










share|improve this question









New contributor




adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I'd like to extract a part of a DEM (data.linz.govt.nz wellinton lidar dem) and analyse it using gdaldem:



$ gdalinfo /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif 
Driver: GTiff/GeoTIFF
Files: /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif
Size is 40827, 59684
Coordinate System is:
PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
GEOGCS["NZGD2000",
DATUM["New_Zealand_Geodetic_Datum_2000",
SPHEROID["GRS 1980",6378137,298.2572221010002,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6167"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4167"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",173],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",1600000],
PARAMETER["false_northing",10000000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","2193"]]
Origin = (1079625.000000000000000,6229400.000000000000000)
Pixel Size = (25.000000000000000,-25.000000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=LZW
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 1079625.000, 6229400.000) (167d22'19.08"E, 33d56'49.88"S)
Lower Left ( 1079625.000, 4737300.000) (166d 6'50.17"E, 47d18'37.53"S)
Upper Right ( 2100300.000, 6229400.000) (178d24'42.42"E, 33d57'24.89"S)
Lower Right ( 2100300.000, 4737300.000) (179d37'20.18"E, 47d19'33.76"S)
Center ( 1589962.500, 5483350.000) (172d52'51.63"E, 40d48' 2.84"S)
Band 1 Block=256x256 Type=Int16, ColorInterp=Gray
NoData Value=-32768
Metadata:
LAYER_TYPE=athematic


That my source.



$ gdal_translate -q -scale -ot Byte -a_nodata 0 -of GTiff -projwin 1744670.939733, 5432632.999810, 1759079.145998, 5417666.249587 -outsize 256 256 /vagrant/public/assets/GeoTIFFs/17a17d1fae/lenz-mean-annual-temperature.2193.tif /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b


I tried all combinations, with or without scale, ot and a_nodata.



$ gdalinfo /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b
Driver: GTiff/GeoTIFF
Files: /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b
Size is 256, 256
Coordinate System is:
PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",
GEOGCS["NZGD2000",
DATUM["New_Zealand_Geodetic_Datum_2000",
SPHEROID["GRS 1980",6378137,298.2572221010002,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6167"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4167"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",173],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",1600000],
PARAMETER["false_northing",10000000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AUTHORITY["EPSG","2193"]]
Origin = (1744650.000000000000000,5432650.000000000000000)
Pixel Size = (56.250000000000000,-58.496093750000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left ( 1744650.000, 5432650.000) (174d43'34.71"E, 41d14'40.64"S)
Lower Left ( 1744650.000, 5417675.000) (174d43'47.53"E, 41d22'46.03"S)
Upper Right ( 1759050.000, 5432650.000) (174d53'53.08"E, 41d14'30.91"S)
Lower Right ( 1759050.000, 5417675.000) (174d54' 7.18"E, 41d22'36.25"S)
Center ( 1751850.000, 5425162.500) (174d48'50.62"E, 41d18'38.57"S)
Band 1 Block=256x32 Type=Byte, ColorInterp=Gray
NoData Value=0
Metadata:
LAYER_TYPE=athematic


gdaldem hillshade works but not slope or any of the other modes:



$ gdaldem slope /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b /dev/stdout -q -of PNG


returns the error:



ERROR 6: PNG driver doesn't support data type Float32. Only eight bit (Byte) and sixteen bit (UInt16) bands supported.


How do I translate the original raster so that conforms with what gdaldem slope and co expect?







gdal gdal-translate gdaldem






share|improve this question









New contributor




adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Apr 3 at 12:18









Vince

14.8k32849




14.8k32849






New contributor




adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 3 at 4:44









adminopasswordoadminopasswordo

61




61




New contributor




adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 2





    Think what the error message says and don't try to create png but create a GeoTIFF instead with -ot GTiff. In the first clipping command leave out -ot Byte. You should not convert DEM into 8 bit.

    – user30184
    Apr 3 at 5:10












  • Your gdaldem slope needs to be output to a format that does support floating point data, like GeoTIFF (-of GTIFF) or ERDAS Imagine (-of HFA) or the lowest form ASCII Grid (-of AAIGRID).. you have told it to output to a PNG which only supports 8 bit unsigned so gdaldem is refusing to write to this driver. Why are you trying to scale your DEM to 8 bit? It should be at least 16 bit integer, most likely 32 bit float or 64 bit float (double), scaling to 8 bit is not fit for any further processing but for display only.

    – Michael Stimson
    Apr 3 at 5:16












  • The idea is to generate a 256*256 PNG map tile to use with leaflet.

    – adminopasswordo
    Apr 3 at 6:13











  • Is my problem that the input from the translation contains data that is neither byte nor UInt16 or that gdaldem cannot do slopes in PNG? Again hillshade works, just not the others.

    – adminopasswordo
    Apr 3 at 7:06












  • 2





    Think what the error message says and don't try to create png but create a GeoTIFF instead with -ot GTiff. In the first clipping command leave out -ot Byte. You should not convert DEM into 8 bit.

    – user30184
    Apr 3 at 5:10












  • Your gdaldem slope needs to be output to a format that does support floating point data, like GeoTIFF (-of GTIFF) or ERDAS Imagine (-of HFA) or the lowest form ASCII Grid (-of AAIGRID).. you have told it to output to a PNG which only supports 8 bit unsigned so gdaldem is refusing to write to this driver. Why are you trying to scale your DEM to 8 bit? It should be at least 16 bit integer, most likely 32 bit float or 64 bit float (double), scaling to 8 bit is not fit for any further processing but for display only.

    – Michael Stimson
    Apr 3 at 5:16












  • The idea is to generate a 256*256 PNG map tile to use with leaflet.

    – adminopasswordo
    Apr 3 at 6:13











  • Is my problem that the input from the translation contains data that is neither byte nor UInt16 or that gdaldem cannot do slopes in PNG? Again hillshade works, just not the others.

    – adminopasswordo
    Apr 3 at 7:06







2




2





Think what the error message says and don't try to create png but create a GeoTIFF instead with -ot GTiff. In the first clipping command leave out -ot Byte. You should not convert DEM into 8 bit.

– user30184
Apr 3 at 5:10






Think what the error message says and don't try to create png but create a GeoTIFF instead with -ot GTiff. In the first clipping command leave out -ot Byte. You should not convert DEM into 8 bit.

– user30184
Apr 3 at 5:10














Your gdaldem slope needs to be output to a format that does support floating point data, like GeoTIFF (-of GTIFF) or ERDAS Imagine (-of HFA) or the lowest form ASCII Grid (-of AAIGRID).. you have told it to output to a PNG which only supports 8 bit unsigned so gdaldem is refusing to write to this driver. Why are you trying to scale your DEM to 8 bit? It should be at least 16 bit integer, most likely 32 bit float or 64 bit float (double), scaling to 8 bit is not fit for any further processing but for display only.

– Michael Stimson
Apr 3 at 5:16






Your gdaldem slope needs to be output to a format that does support floating point data, like GeoTIFF (-of GTIFF) or ERDAS Imagine (-of HFA) or the lowest form ASCII Grid (-of AAIGRID).. you have told it to output to a PNG which only supports 8 bit unsigned so gdaldem is refusing to write to this driver. Why are you trying to scale your DEM to 8 bit? It should be at least 16 bit integer, most likely 32 bit float or 64 bit float (double), scaling to 8 bit is not fit for any further processing but for display only.

– Michael Stimson
Apr 3 at 5:16














The idea is to generate a 256*256 PNG map tile to use with leaflet.

– adminopasswordo
Apr 3 at 6:13





The idea is to generate a 256*256 PNG map tile to use with leaflet.

– adminopasswordo
Apr 3 at 6:13













Is my problem that the input from the translation contains data that is neither byte nor UInt16 or that gdaldem cannot do slopes in PNG? Again hillshade works, just not the others.

– adminopasswordo
Apr 3 at 7:06





Is my problem that the input from the translation contains data that is neither byte nor UInt16 or that gdaldem cannot do slopes in PNG? Again hillshade works, just not the others.

– adminopasswordo
Apr 3 at 7:06










1 Answer
1






active

oldest

votes


















0














I found my answer in the fine print: slope will output a 32-bit float and so will aspect, so no PNG without post processing.



No idea what type TRI and TPI spit out.



Color-relief however returns RGB or RGBA. I had initially missed the color map file, so this is working now.



gdaldem color-relief /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b color_relief.txt /dev/stdout -q -of PNG -alpha





share|improve this answer








New contributor




adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "79"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    adminopasswordo is a new contributor. Be nice, and check out our Code of Conduct.









    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317585%2fpng-driver-chokes-on-raster-gdal-transformed-to-ot-byte%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I found my answer in the fine print: slope will output a 32-bit float and so will aspect, so no PNG without post processing.



    No idea what type TRI and TPI spit out.



    Color-relief however returns RGB or RGBA. I had initially missed the color map file, so this is working now.



    gdaldem color-relief /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b color_relief.txt /dev/stdout -q -of PNG -alpha





    share|improve this answer








    New contributor




    adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      0














      I found my answer in the fine print: slope will output a 32-bit float and so will aspect, so no PNG without post processing.



      No idea what type TRI and TPI spit out.



      Color-relief however returns RGB or RGBA. I had initially missed the color map file, so this is working now.



      gdaldem color-relief /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b color_relief.txt /dev/stdout -q -of PNG -alpha





      share|improve this answer








      New contributor




      adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















        0












        0








        0







        I found my answer in the fine print: slope will output a 32-bit float and so will aspect, so no PNG without post processing.



        No idea what type TRI and TPI spit out.



        Color-relief however returns RGB or RGBA. I had initially missed the color map file, so this is working now.



        gdaldem color-relief /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b color_relief.txt /dev/stdout -q -of PNG -alpha





        share|improve this answer








        New contributor




        adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        I found my answer in the fine print: slope will output a 32-bit float and so will aspect, so no PNG without post processing.



        No idea what type TRI and TPI spit out.



        Color-relief however returns RGB or RGBA. I had initially missed the color map file, so this is working now.



        gdaldem color-relief /tmp/silverstripe-cache-php7.2.15-1+ubuntu16.04.1+deb.sury.org+1-vagrant/www-data/5ca433d05e16b color_relief.txt /dev/stdout -q -of PNG -alpha






        share|improve this answer








        New contributor




        adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 2 days ago









        adminopasswordoadminopasswordo

        61




        61




        New contributor




        adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        adminopasswordo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.




















            adminopasswordo is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            adminopasswordo is a new contributor. Be nice, and check out our Code of Conduct.












            adminopasswordo is a new contributor. Be nice, and check out our Code of Conduct.











            adminopasswordo is a new contributor. Be nice, and check out our Code of Conduct.














            Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f317585%2fpng-driver-chokes-on-raster-gdal-transformed-to-ot-byte%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

            QGIS export composer to PDF scale the map [closed] Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Print Composer QGIS 2.6, how to export image?QGIS 2.8.1 print composer won't export all OpenCycleMap base layer tilesSave Print/Map QGIS composer view as PNG/PDF using Python (without changing anything in visible layout)?Export QGIS Print Composer PDF with searchable text labelsQGIS Print Composer does not change from landscape to portrait orientation?How can I avoid map size and scale changes in print composer?Fuzzy PDF export in QGIS running on macSierra OSExport the legend into its 100% size using Print ComposerScale-dependent rendering in QGIS PDF output

            PDF-ში გადმოწერა სანავიგაციო მენიუproject page