2

I am using the Weighted Overlay tool in Arcpy and I've not had this issue before with other tools. I'm wondering if it's a tool-specific problem. The output I get from the weighted overlay tool saves in both the workspace I set earlier in the script (this is also where all the layers involved in the overlay are contained) and also the actual output location I want it to go to. I know sometimes arcpy saves temp layers, but it's not saving a temp layer in the set workspace - it does not disappear after closing down the programs. The goal here is to keep the workspace unchanged, and save the output only in the location that I have specified as "outputFolder."

Is there something implicitly wrong in my code?

UPDATE
I have found that the layer being saved in the output folder actually contains data, while the layer being [automatically] saved in the set workspace is empty. From this I'm assuming that the layer in the set workspace is most certainly a "temp" layer but why is it sticking around in my workspace after the process has run and the raster layer as been saved elsewhere?

outputFolder = #some directory here
for stuff in stuffs:
    arcpy.env.workspace = batWrkspace
    #do stuff
    #Create weighted overlay table for Western Washington model
    WstWATable = arcpy.sa.WOTable([[age, spp_weights[0], "VALUE", remap],
                              [dbh, spp_weights[1], "VALUE", remap],
                              [elev, spp_weights[2], "VALUE", remap],
                              [tree_spp, spp_weights[3], "VALUE", remap],
                              [water, spp_weights[4], "VALUE", remap],
                              [bridges, spp_weights[5], "VALUE", remap],
                              [caves, spp_weights[6], "VALUE", remap],
                              [cliffs, spp_weights[7], "VALUE", remap],
                              [mines, spp_weights[8], "VALUE", remap],
                              [talus, spp_weights[9], "VALUE", remap]],
                              [1,3,1])

#Perform weighted overlay for Western Washington model
WO_Result = arcpy.sa.WeightedOverlay(WstWATable)

#Save output
outputName = '{0}_wstwa_hb'.format(folder.lower())
WO_Result.save(os.path.join(outputFolder, outputName))
  • Can you provide an example of what the outputFolder path/string looks like? – artwork21 Jul 27 '16 at 16:15
  • @artwork21 Sure. The outputFolder string looks like this: r"\\dnr\divisions\FR_DATA\hcp\gis\projects\mfol490\OutputFolder" – MKF Jul 27 '16 at 17:35
  • As an aside in case you are wondering, the \\ at the beginning of the path does not cause an error. – MKF Jul 27 '16 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.