1

I am using ArcMap 10.7.

I have a multitude of shapefiles representing glacial lakes in different stages of their formation, each shapefile produced using a different climate model as basis. All results displayed looks something like this:
enter image description here
As can be seen, the models do not agree on the extent of the lake formation. The "green model" produced the largest lake extents, the "brown model" the smallest ones. I have used 15 models, each for 4 SSP scenarios and 8 timesteps (so all in all 480 shapefiles).

For each lake part in a given scenario and timestep, I now want to quantify the number of models agreeing on its formation. Using Intersect manually gives me only the areas where the models overlap without any information on how many overlap there. And, due to the number of shapefiles, it is not feasible. So far, I could use a number of for-loops (slow, I know, but I don't have a better idea) to go through every model, scenario and timestep and do the intersect like this:

for i in range(models):
    for j in range(scenarios):  
        for i in range(timesteps):
            shapelist = []
            for shapefile in folder:
                if shapefile.endswith(".shp"):
                    shape_location = os.path.join(folder, shapefile)
                    shapelist.append(shape_location)
                    arcpy.Intersect_analysis(in_features=shapelist,
                                             out_feature_class=os.path.join(some_folder, "intersect.shp"))

But I'm stuck on how to determine the number of overlapping polygons for each lake. Is there another way to use Intersect, or another arcpy-related workflow that I could use?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Florian Mlehliv
  • 759
  • 5
  • 13

1 Answers1

1

I think you should do it in batches, so output of these:

for shapefile in folder:
    if shapefile.endswith(".shp"):
        shape_location = os.path.join(folder, shapefile)
        shapelist.append(shape_location)
Merge(shapelist,in_memory/MERGED_BUFFERS")
FeatureToPolygon("MERGED_BUFFERS", "INDIV_POLYGONS")
FeatureToPoint("INDIV_POLYGONS", "id_point", "INSIDE")
GenerateNearTable(in_features="id_point", near_features="MERGED_BUFFERS", out_table="in_memory/NEAR_TABLE", search_radius="0 Meters")

Will give you a table:

enter image description here

Frequency of 1st highlighted fields will give you count of overlaps for each INDIV_POLYGONS.

This only works when merged boundaries of 2 polygons create 2 or 3 polygons

enter image description here

If this is not the case, e.g.:

enter image description here

you have to create multipoints first:

SpatialJoin("id_point", "MERGED_BUFFERS", "id_point_SpatialJoin", join_operation="JOIN_ONE_TO_MANY", join_type="KEEP_COMMON", field_mapping='FID_A_Merge "FID_A_Merge" true true false 0 Long 0 0 ,First,#,id_point,FID_A_Merge,-1,-1;ORIG_FID "ORIG_FID" true true false 0 Long 0 0 ,First,#,id_point,ORIG_FID,-1,-1', match_option="INTERSECT", search_radius="", distance_field_name="")
Dissolve("id_point_SpatialJoin", "id_point_SpatialJoin_Dissolv", "JOIN_FID")

and proceed with NEAR TABLE as described above:

enter image description here

FelixIP
  • 22,922
  • 3
  • 29
  • 61