"If something is hard you should just give up, since it probably wasn't worth doing it in the first place."
pointDict = {} pointFcList = ["tower_1.shp","tower_2.shp","tower_3.shp"] for pointFc in pointfcList: searchRows = arcpy.da.SearchCursor(pointFc, ["SHAPE@XY","DISTANCE"]) towerId = pointFc.split("_")[-1] for searchRow in searchRows: xyKey, distance = searchRow if xyKey not in pointDict: pointDict[xyKey] = [(distance, towerId)] else: pointDict[xyKey].append((distance, towerId)) for keyKey in pointDict: pointDict[xyKey].sort()
but how do I do this? the euclidean distance only shows how far it is to the closest turbine and doesn't give me any idea which turbine it is...
But I need the ID to the closest, the second closest, the thrid closest and so on.
How about making a euclidean allocation grid for the 1st closest, then another one for the 2nd, 3rd, etc.. Then use the combine tool to basically union all the euclidean allocation grids?
Maybe it would just be easier to make a bunch of seperate viewshed rasters and then combine them together.... then cursor through the table and work out some sort of scoring system.
VIEWSHED_1 VIEWSHED_2 VIEWSHED_3 0 1 1 0 2 0 0 3 0
rasters2 = arcpy.ListRasters("Raster*") for raster in rasters: print "processing raster:"+raster #big extent arcpy.env.extent = "C:/studium/00_Master/clean/clipper.shp" #convert nodata to zero out1 = Con(IsNull(raster), 0, raster) #sum rasters together if i == 0: out2 = out1 i += 1 else: out2 = out2 + out1 i += 1 head, tail = ntpath.split(raster) #save final output out2.save("C:/studium/project/script6/output.tif")
arcpy.env.extent = "C:/studium/00_Master/clean/clipper.shp" comboGrdList = [] rastersList = arcpy.ListRasters("Raster*") for raster in rasterList: out1 = Con(IsNull(raster), 0, raster) out1.save("twr_" + str(raster.split("_")[-1])) #assuming that raster is something like "tower_12" comboGrdList.append(out1) comboGrd = arcpy.sa.Combine(comboGrdList)
comboGrd = arcpy.sa.Combine(comboGrdList)
create a heat map or the like (I think that's basically what you have)normalize the values for the heat map so that they range from 0 to 1
for pointFc in pointfcList:
for keyKey in pointDict: pointDict[xyKey].sort()
towerId = pointFc.split("_")[-1]
Question: What if two towers were visible: One at 200m distance, and the other at 201m distance (shouldn't that distance rank variable be a bit more scaler?)
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.