When trying to use RasterInfo to pass the pixel type value of raster tiles that will be fed into the arcpy MosaicToNewRaster function, an error results because the string value stored in RasterInfo does not match the values expected in MosaicToNewRaster. For example, with a 32-bit float raster, can we please have either a Raster object's pixel type value be '32_BIT_FLOAT' or have MosaicToNewRaster be able to read in '32F' in this case ? Or better yet, can MosaicToNewRaster be able to infer pixel type (and band count for that matter) as it is able to infer spatial reference and cell size?
From https://gis.stackexchange.com/questions/445836/feed-pixel-type-of-tiles-into-mosaictonewraster:
# import arcpy, os # Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial") arcpy.env.workspace = "My_Data_Directory_Path" # Create list of input raster tiles list_opr_tiles = arcpy.ListRasters() list_tile_paths = [os.path.join("My_Data_Directory_Path", tile) for tile in list_opr_tiles] # Instantiate instance of RasterInfo object rasInfo = arcpy.Raster(list_tile_paths[0]).getRasterInfo() # Assign variable to raster's pixelType property string_pixel_type = rasInfo.getPixelType() # Assign variable to raster's bandCount property string_band_count = rasInfo.getBandCount() arcpy.MosaicToNewRaster_management(input_rasters = list_tile_paths, output_location = "My_Output_Directory_Path", raster_dataset_name_with_extension = "My_Mosaic_Name", pixel_type = string_pixel_type, number_of_bands = string_band_count)
@Eniac-6 - Thanks for bringing this up. Our development team will look into this issue.
Regards
Saravanan
Product Engineer, Raster team - Esri
Thank you, @Anonymous User !
Note: 11-29-2022 04:35 AM post from Anonymous User by @SaravananMuthukaruppan.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.