I am attempting to create a custom ArcGIS Pro Python Toolbox tool and some of the geoprocessing tools I use run slowly or not at all if the input DEM or environment is not projected first. I would like to make the tool have the option of selecting the projection with the built in tools like in the Project Raster tool where you have the option to select the coordinate system, but I cannot figure out how to call that.
The current work around I have discovered is creating a .prj file of the coordinate system you wish to project into and using that file as a parameter to feed into your script like so.
projection = arcpy.Parameter(
displayName="Projection for DEM",
name="projection",
datatype="DEPrjFile",
parameterType="Required",
direction="Input")
Then using arcpy.management.ProjectRaster()
to project using the .prj file.
I believe there must be a better way to access the built in Coordinate systems.
Best Answer
See Defining parameter data types in a Python toolbox.
I would use either
GPCoordinateSystem
orGPSpatialReference
.