Skip to main content

Good morning,

I am reading a DEM stored as a raster feature class in a gdb, clipping to an AOI and then writing to JPEG to be used in road design software.

I can read and clip properly but having trouble writing to JPEG. I have gathered I need to set up bands differently but I have tried the rasterbandinterpretationcoercer and rasterbandadder and rasterinterpretationcoecer in various configurations/settings and can’t seem to get it to write a JPEG. Usual error is about the number or type of bands depending on how I set the coercers etc.

DEM raster feature information

 

Any suggestions would be welcome.

Thank you so much,

Corey

Hello @coreyross 

The second band in your raster is odd. Band 0 with the actual DEM values is real32 while band 1 is an alpha8 band with nodata as 255.

If band 1 doesn’t contain valid data, you can try separating the two bands with a RasterBandSeparator, select band 0, then use a RasterInterpretationCoercer to coerce band 0 to Gray8 (or another JPEG supported band interpretation) before the JPEG writer.

 


 

Thanks for this help. This has got the JPEG writing and that’s a huge help. I did a quick test and I am not sure the elevation values are being written but I need to do a bit more digging.

 

Edit: It just occurred to me it might not be possible to store elevation information in a jpg of this type. I need to check with the end user how they are using this raster in their process. It may only be a visual aid.

 

Thanks again,

Corey

 

Hello @coreyross 

The second band in your raster is odd. Band 0 with the actual DEM values is real32 while band 1 is an alpha8 band with nodata as 255.

If band 1 doesn’t contain valid data, you can try separating the two bands with a RasterBandSeparator, select band 0, then use a RasterInterpretationCoercer to coerce band 0 to Gray8 (or another JPEG supported band interpretation) before the JPEG writer.

 

 


Reply