addLayer = arcpy.mapping.Layer(r"\\<server name>\GIS 249\Wk02_Spatial Analyst\Thursday\Learn01\VirtualCampus\LearnSA9\MapAlgebra\Piru.gdb\FirePer")
You could create a script that runs the 'Make Raster Layer' function for each raster. If you have 'Add results of geoprocessing to the display" checked on within the Geoprocessing options, the raster layers will automatically be added to the current map document.arcpy.MakeRasterLayer_management("C:/DATA/RASTER/DEM/example", "example") arcpy.MakeRasterLayer_management("C:/DATA/RASTER/DEM/example2", "example2")
arcpy.MakeRasterLayer_management("C:/DATA/RASTER/DEM/example", "example") arcpy.MakeRasterLayer_management("C:/DATA/RASTER/DEM/example2", "example2")
Hi,arcpy.MakeRasterLayer_management is meant to other purpose, so you can skip this. Code below should help. If you want to change layer name use:addLayer.name = new_name before adding layer to map doc. fc_list=[fc_meanSun,fc_lowSun] mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0] for ras_name in fc_list: fc=fc_path+'\\'+ras_name addLayer = arcpy.mapping.Layer(fc) arcpy.mapping.AddLayer(df,addLayer) Regards.Arek
fc_list=[fc_meanSun,fc_lowSun] mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0] for ras_name in fc_list: fc=fc_path+'\\'+ras_name addLayer = arcpy.mapping.Layer(fc) arcpy.mapping.AddLayer(df,addLayer)
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.