TransWikia.com

Saving band math output as TIFF using ArcPy

Geographic Information Systems Asked by Jay Dilla on February 20, 2021

I’m trying to do some band math using ArcPy for ArcGIS Pro. I want the output to be a TIFF file. However, my following code is outputting in GRID format even though the input is TIFF.

band1 = "C:Geoprocessing_band_1_rast1"

Raster_Calculator = band1

raster1 = arcpy.Raster(r"C:image.tif")

band1 = raster1 * 100000

band1.save(Raster_Calculator)

How can I add code to make the output TIFF?

One Answer

You need to specify the .tif extension when you save the raster, otherwise it will save to grid format. It is a good practice to explicitly define your input and output rasters. Here are the changes I would make:

in_raster =  r"C:image.tif"
out_raster = r"C:Geoprocessingband_1_rast1.tif"

raster1 = arcpy.Raster(in_raster)

band1 = raster1 * 100000

band1.save(out_raster) 

Correct answer by Aaron on February 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP