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

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

            Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

            Romeo and Juliet ContentsCharactersSynopsisSourcesDate and textThemes and motifsCriticism and interpretationLegacyScene by sceneSee alsoNotes and referencesSourcesExternal linksNavigation menu"Consumer Price Index (estimate) 1800–"10.2307/28710160037-3222287101610.1093/res/II.5.31910.2307/45967845967810.2307/2869925286992510.1525/jams.1982.35.3.03a00050"Dada Masilo: South African dancer who breaks the rules"10.1093/res/os-XV.57.1610.2307/28680942868094"Sweet Sorrow: Mann-Korman's Romeo and Juliet Closes Sept. 5 at MN's Ordway"the original10.2307/45957745957710.1017/CCOL0521570476.009"Ram Leela box office collections hit massive Rs 100 crore, pulverises prediction"Archived"Broadway Revival of Romeo and Juliet, Starring Orlando Bloom and Condola Rashad, Will Close Dec. 8"Archived10.1075/jhp.7.1.04hon"Wherefore art thou, Romeo? To make us laugh at Navy Pier"the original10.1093/gmo/9781561592630.article.O006772"Ram-leela Review Roundup: Critics Hail Film as Best Adaptation of Romeo and Juliet"Archived10.2307/31946310047-77293194631"Romeo and Juliet get Twitter treatment""Juliet's Nurse by Lois Leveen""Romeo and Juliet: Orlando Bloom's Broadway Debut Released in Theaters for Valentine's Day"Archived"Romeo and Juliet Has No Balcony"10.1093/gmo/9781561592630.article.O00778110.2307/2867423286742310.1076/enst.82.2.115.959510.1080/00138380601042675"A plague o' both your houses: error in GCSE exam paper forces apology""Juliet of the Five O'Clock Shadow, and Other Wonders"10.2307/33912430027-4321339124310.2307/28487440038-7134284874410.2307/29123140149-661129123144728341M"Weekender Guide: Shakespeare on The Drive""balcony"UK public library membership"romeo"UK public library membership10.1017/CCOL9780521844291"Post-Zionist Critique on Israel and the Palestinians Part III: Popular Culture"10.2307/25379071533-86140377-919X2537907"Capulets and Montagues: UK exam board admit mixing names up in Romeo and Juliet paper"Istoria Novellamente Ritrovata di Due Nobili Amanti2027/mdp.390150822329610820-750X"GCSE exam error: Board accidentally rewrites Shakespeare"10.2307/29176390149-66112917639"Exam board apologises after error in English GCSE paper which confused characters in Shakespeare's Romeo and Juliet""From Mariotto and Ganozza to Romeo and Guilietta: Metamorphoses of a Renaissance Tale"10.2307/37323537323510.2307/2867455286745510.2307/28678912867891"10 Questions for Taylor Swift"10.2307/28680922868092"Haymarket Theatre""The Zeffirelli Way: Revealing Talk by Florentine Director""Michael Smuin: 1938-2007 / Prolific dance director had showy career"The Life and Art of Edwin BoothRomeo and JulietRomeo and JulietRomeo and JulietRomeo and JulietEasy Read Romeo and JulietRomeo and Julieteeecb12003684p(data)4099369-3n8211610759dbe00d-a9e2-41a3-b2c1-977dd692899302814385X313670221313670221