I want to project many raster files in a folder (but they appear in the content of my ArcGIS project). Here is the screenshot.
These raster files have an unknown coordinate system. When I try to project them manually, the input and output coordinate system is shown below. And I have successfully project several raster files manually.
As you can see, the input and output coordinate system is the same "GCS_WGS_1984". I can manually project these raster files but want to find how to accomplish this using python. Also, after projecting, how to make sure they will appear in my gdb project for future use.
I tried to use the following code but it did not work.
import arcpy arcpy.env.workspace = r"D:\STAR\info_data_test" #this is the folder where raster files are arcpy.env.overwriteOutput = True #overwrite the exsiting files rasterfiles = list(set(arcpy.ListDatasets("b*","Raster"))) #list all the raster files inside the folder with name starting "b" base = "D:/STAR/assignment/assignment7/Zhenyu_Assign7_GISpro/Zhenyu_Assign7_GISpro.gdb/b90w90r65s400Pro" #using the exsiting projected raster file as base out_coor_system = arcpy.Describe(base).spatialReference #get the coordinate system of this base raster file for raster in rasterfiles: outraster = raster + "Pro" arcpy.ProjectRaster_management(raster,outraster,base)
I do not know how to project these raster files and then put them into my gdb project for future use.