I have to reproject a shapefile's coordinate system. To do that I am using Arcpy and I want to get an output to use it as input in other tool (in Model Builder).
Now I get an output, but I cannot use it as input in model builder's tool. I am not programing well when I process the output shapefile.
The code is:
def getParameterInfo(self):
"""Define parameter definitions"""
# First parameter
param0 = arcpy.Parameter(
displayName="Shape entrada a reproyectar",
name="in_features",
datatype="DEShapefile",
parameterType="Required",
direction="Input")
# Second parameter
param1 = arcpy.Parameter(
displayName="Imagen satelite de la cual se utilizara el CRS",
name="raster",
datatype="GPRasterLayer",
parameterType="Required",
direction="Input")
# Third parameter
param2 = arcpy.Parameter(
displayName="Shape de salida",
name="out_features",
datatype="DEShapefile",
parameterType="Derived",
direction="Output")
parameters = [param0, param1, param2]
return parameters`
def execute(self, parameters, messages):
"""The source code of the tool."""
shape= parameters[0].valueAsText
raster= parameters[1].valueAsText
output=parameters[2].valueAsText
#-----------------------------
desc = arcpy.Describe(shape)
out_CRS = arcpy.Describe (raster).spatialReference
output=arcpy.Project_management(shape, desc.path + "\\" + desc.baseName + "_Rprj.shp", out_CRS)
return