AnsweredAssumed Answered

Weighted Overlay - passing parameter as text error?

Question asked by wtgeographer on Mar 25, 2014
Latest reply on Mar 26, 2014 by wtgeographer
For some reason when hardcoding the save path for the wieghted raster just before runtime it works perfectly. Like such...
arcpy.env.cellSize = "90" arcpy.env.workspace = r'G:\Xcel\Route Tool\Potter\Scratch.gdb' landuseRaster = r'G:\Xcel\Route Tool\Potter\Data.gdb\Potter_Randall_Landuse_Raster' slope_Reclass_Raster = r'G:\Xcel\Route Tool\Potter\Scratch.gdb\slope_Reclass'  #Generate a list identifying what the individual input values should be reclassified as. remapLanduse = RemapValue([['Cropland and pasture',2],['Herbaceous Rangeland',1],['Nonforested wetland',10],['Other agricultural land',1],['Strip mines, quarries and gravel pits',2],                             [ 'Mixed rangeland',1],['Lakes',10],['Residential',3],['Commercial and Services',3],['Confined feeding operations',3],['Transportation, communications and services',10],                             ['Transitional areas',3],['Shrub-brushland rangeland',1],['Other urban or built-up land',3],['Bare exposed rock',3],['Industrial',2],['Reservoirs',10],['Forested wetland',10],['Mixed urban or built-up land',3]])  remapSlope = RemapValue([[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10]])   #Define the input rasters, the field identifying the input values, the remap of their values, the weight of each raster, and the evaluation scale to use in the Weighted Overlay tool. myWOTable = WOTable([[landuseRaster, 80, "LANDUSE", remapLanduse],                      [slope_Reclass_Raster, 20, "Value", remapSlope],                      ], [1, 10, 1])  outWeightedOverlay = WeightedOverlay(myWOTable)  arcpy.AddMessage("Creating weighted raster...") weighted_Raster = env.workspace + '\weighted_Raster' outWeightedOverlay.save(weighted_Raster)


However when I try to pass the workspace to weighted overlay tool using parameter as text I receive a generic 999999 error? Like such....
subs  = arcpy.GetParameterAsText(0) Field = arcpy.GetParameterAsText(1) originValue = arcpy.GetParameterAsText(2) destValue   = arcpy.GetParameterAsText(3) lines = arcpy.GetParameterAsText(4) Dem = arcpy.GetParameterAsText(5) landuseRaster = arcpy.GetParameterAsText(6) outwork = arcpy.GetParameterAsText(7)  arcpy.env.workspace = outwork + "\Scratch.gdb"


.... run a few tools including generate 'slope_Reclass_Raster'
#Generate a list identifying what the individual input values should be reclassified as. remapLanduse = RemapValue([['Cropland and pasture',2],['Herbaceous Rangeland',1],['Nonforested wetland',10],['Other agricultural land',1],['Strip mines, quarries and gravel pits',2],                             [ 'Mixed rangeland',1],['Lakes',10],['Residential',3],['Commercial and Services',3],['Confined feeding operations',3],['Transportation, communications and services',10],                             ['Transitional areas',3],['Shrub-brushland rangeland',1],['Other urban or built-up land',3],['Bare exposed rock',3],['Industrial',2],['Reservoirs',10],['Forested wetland',10],['Mixed urban or built-up land',3]])  remapSlope = RemapValue([[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10]])   #Define the input rasters, the field identifying the input values, the remap of their values, the weight of each raster, and the evaluation scale to use in the Weighted Overlay tool. myWOTable = WOTable([[landuseRaster, 80, "LANDUSE", remapLanduse],                      [slope_Reclass_Raster, 20, "Value", remapSlope],                      ], [1, 10, 1])  outWeightedOverlay = WeightedOverlay(myWOTable)  arcpy.AddMessage("Creating weighted raster...") weighted_Raster = env.workspace + '\weighted_Raster' outWeightedOverlay.save(weighted_Raster)

Outcomes