I am using python to project a dem file. The code I used is attached below:
import arcpy
arcpy.env.overwriteOutput = True
# Script arguments
Input_dem = "E:\\OneDrive\\Academic\\PhD\\Philemon\\phase_3_(model)\\dem_raw\\Mago_raw.tif"
Workspace = "E:\\OneDrive\\Academic\\PhD\\Philemon\\phase_3_(model)\\useful_data"
Output_Coordinate_System = "PROJCS['WGS_1984_UTM_Zone_46N',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',93.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]" # provide a default value if unspecified
# Local variables:
reprojected = "%Workspace%\\reprojected"
# Process: Project Raster
arcpy.ProjectRaster_management(Input_dem, reprojected, Output_Coordinate_System, "NEAREST", "87.6969856825158 87.6969856825151", "", "", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]")
The above code does the job of reprojecting the dem, but is not being stored in the assigned workspace. A little search with my novice search showed that the files are stored in the 'temp' folder under my username (windows).
using arcpy.env.workspace
gets the job done, but I want to how to get the above code working. Thank you in advance.
Use arcpy.env.workspace = "E:\\OneDrive\\Academic\\PhD\\Philemon\\phase_3_(model)\\useful_data"
instead of naked workspace
variable