1

I'm trying to use

MosaicToNewRaster

but a lot of errors are appears. One of them is:

ERROR 000732: Output Location: Dataset results does not exist or is not supported

My code is:

import arcpy

from arcpy import env env.workspace = "C:\Users\user\Documents\ArcGIS\teste"

arcpy.MosaicToNewRaster_management("SG-21-Z-D.tif;SG-22-Y-C.tif","C:\Users\user\Documents\ArcGIS","marco.tif","","1_BIT","0.000833333353511989","1")

Should I change something?

0

1 Answer 1

4

Your workspace is missing the r before the path or you can replace one backslash \ with two backslashes \\ or you can replace the backslash \ with a forward slash /. You can adjust your code based on the following example:

import arcpy
from arcpy import env

# Set the current workspace
ws = env.workspace = r"F:\Ahmad\Test\DEM"

# Get a list of raster from the workspace
rasterlist = arcpy.ListRasters()
print(rasterlist)

# OR you can pass your target raster data to a list
# rasterlist = [SG-21-Z-D.tif,SG-22-Y-C.tif]

# Execute MosaicToNewRaster_management() tool
mosaic = arcpy.MosaicToNewRaster_management(rasterlist,ws,'MosaicFinal.tif','',pixel_type='16_BIT_SIGNED',number_of_bands=1)

Check the Mosaic To New Raster help for more information.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.