Select to view content in your preferred language

Analysis

4821
7
Jump to solution
01-02-2015 08:23 AM
TinaKwitkoski
Regular Contributor

Hi,

I have a question, I have been given the task to figure out which of my 5 "land interests" are overlapped by a list of "cutblocks (polygons)" and have the resultant in XLS format. I am using Arc Advanced 10.1.

I assumed I could use the Intersect geoprocessing tool, but it does not work. If I do the intersect 1 'interest' at a time with the cutblocks, it seems to be correct, but adding in all 5 does not.

Any advise out there as to what I should be using instead? This type of analysis is fairly new to me.

Thanks and Happy 2015

Tina

0 Kudos
1 Solution

Accepted Solutions
RichardFairhurst
MVP Honored Contributor

Tina:

Just to explain why it did not work, each feature class is intersected in turn of the 6 you inputted and only the set of features that intersect in all 6 feature classes will be returned (not 5 of the 6 or less).  This is logical, since nothing tells the tool to consider 5 of the 6 inputs to be treated as one merged feature class intersected with only the cutblock feature class.  The best approach would have been to first merge the 5 feature classes into one, then do the intersect with the cutblocks.  Fewer steps (4 fewer intersects than you did).

The tool would work as expected if you had inputted 6 feature classes of entirely different polygon sets all of which intersect with each other, like one interest, cutblocks, zoning, land use, vegetation, and cities.  Any portion not within any one of those 6 feature classes would have been excluded from the output, but where all 6 overlap you would find the combination of all 6 layer's attributes.

The Union tool would do the same analysis, but include all instances where any one of the feature classes existed, so you could find out where only one exists, 2 of 6 exists, 3 of 6 exists, etc.  The Union tool would not work for your problem, because it would not merge data from the 5 interests into the minimum number of fields to hold common attributes.  In other words, you would have Name, Name_2, Name_3, Name_4, and Name_5 if all five interests had the attribute Name.  Merging or appending the five interests first results in just one Name field for all 5 interests, which is what you want.

View solution in original post

7 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Tina,

You could achieve this using Python.  You can easily iterate through the 'interests' feature class to select each interest area, perform the intersect on this interest, and then export the result to an Excel file.

import arcpy
from arcpy import env
env.overwriteOutput = 1
env.workspace = r"C:\temp\python\test.gdb"

interests = "Interests"
cutblocks = "Cutblocks"

with arcpy.da.SearchCursor(interests, ["NAME"]) as cursor:
    for row in cursor:
        arcpy.MakeFeatureLayer_management(interests, "interestsLyr", "NAME = '" + row[0] + "'")
        arcpy.Intersect_analysis(["interestsLyr", cutblocks], env.scratchGDB + "\\output")
        arcpy.TableToExcel_conversion(env.scratchGDB + "\\output", r"C:\temp\python\interests_" + row[0] + ".xls")

del cursor

The above code creates a feature layer by selecting each interest based on a field called 'NAME'.  It performs the intersect and writes the output to a scratch geodatabase, and then exports this feature class to an excel file.

TinaKwitkoski
Regular Contributor

Jake,

thanks for the code, but at the end the table to excel will not work in 10.1. so I will just use the merge function and export to dbf then xls..

Thanks

Tina 

0 Kudos
RichardFairhurst
MVP Honored Contributor

In what way doesn't intersecting all 5 interests against the cutblocks "work"?  You have given very little information that would let us replicate your data or outputs.  Intersect rarely needs to be done one polygon set at a time if the attributes are evaluated correctly from the full set.  So I see nothing in your post that lets me understand what kind of problem you are having.  I would appreciate a little more insight into what your inputs look like (are there just two polygon feature classes, many feature classes, etc) and what your output should look like (separate tables for each interest or one table with all interests listed and all applicable cutblocks).

If you have 5 separate interest polygon feature classes, then they would have to be merged first (with appropriate attributes to keep track of what polygons came from what sources) before intersecting them with the cutblocks if you want to do everything in a single intersect analysis.

0 Kudos
TinaKwitkoski
Regular Contributor

My data is 5 shape files (interests) and 1 cutblock shape file.

What I ended up doing was manually interesecting each one against the Cutblock, then merging the 5 together so I could export out to dbf then save as xls.

I thought the intersect would take all 5 shapefiles at once and interesect with the 1 Cutblock file.. did not work the way I thought it would.. I was hoping for each Cutblock I would have a record of each interest that overlapped it..

0 Kudos
RichardFairhurst
MVP Honored Contributor

Tina:

Just to explain why it did not work, each feature class is intersected in turn of the 6 you inputted and only the set of features that intersect in all 6 feature classes will be returned (not 5 of the 6 or less).  This is logical, since nothing tells the tool to consider 5 of the 6 inputs to be treated as one merged feature class intersected with only the cutblock feature class.  The best approach would have been to first merge the 5 feature classes into one, then do the intersect with the cutblocks.  Fewer steps (4 fewer intersects than you did).

The tool would work as expected if you had inputted 6 feature classes of entirely different polygon sets all of which intersect with each other, like one interest, cutblocks, zoning, land use, vegetation, and cities.  Any portion not within any one of those 6 feature classes would have been excluded from the output, but where all 6 overlap you would find the combination of all 6 layer's attributes.

The Union tool would do the same analysis, but include all instances where any one of the feature classes existed, so you could find out where only one exists, 2 of 6 exists, 3 of 6 exists, etc.  The Union tool would not work for your problem, because it would not merge data from the 5 interests into the minimum number of fields to hold common attributes.  In other words, you would have Name, Name_2, Name_3, Name_4, and Name_5 if all five interests had the attribute Name.  Merging or appending the five interests first results in just one Name field for all 5 interests, which is what you want.

TinaKwitkoski
Regular Contributor

Thanks Richard for the explanation.
So just trying to understand your reply, the reason why I got one Cutblock result when I orginally used all 5 shapefiles in the Intersect was that was the only block to intersect with all 5 shapes?

I did not realize I could merge 5 different shapefiles (mine were FN, Trappers, Guides, Private Land, and Range) into one "big" file. Now I know and I will try this out see if I get the same results as I did individually.

Thanks for all your help in getting me to understand this tool.

Happy New Year

Tina

0 Kudos
RichardFairhurst
MVP Honored Contributor

Overlaps interior to a feature class will affect your final result.  I was conceiving of your interests as more like 5 sets of parcel ownerships or 5 different land use categories, where edge overlaps between polygons in that set do not exist.  However, if that is not the case and these interests have many different overlaps, then first merging them into one feature class will result in the correct answer in terms of which cutblocks they intersect, but the overlaps will result in more redundant records listing the same interest and cutblock combination due to any overlap intersections between separate interests.  A Dissolve would be necessary to remove these redundancies to get all of the unique combinations of interests and cutblocks in the minimum number of records and shapes.

So if FN, Trappers, Guides, Private Land and Range have the same set of attributes then Merge or Append will keep those fields to the minimum for each shape.  Merge or append will not change the shapes.  However, during the intersect if this combination of 5 shapefiles into 1 shapefile contains many overlapping polygons within the shapefile, each of those overlapping shapes will first be cut wherever they overlap (so for example 2 polygons that overlap on one shared edge would first turn into 3 polygons), but none would be eliminated due to intersecting another polygon in the same feature class and the number of attributes fields would remain the same in that one merged feature class.  So, if a lot of overlaps in your interests exist in the set of combined polygons, then the result would not be exactly the same as the individual intersects, because more records would be created to reflect the breakup of those overlaps.  The same is true in the cutblocks as well.  Overlaps of 2 cutblocks will first be cut up into at least 3 shapes first and then those 3 shapes will intersect with the interests.

Union would do the same with two shapefile inputs, cutting shapes at every overlap within either of the two feature classes and at every overlap between the two feature classes, but the output would include every combination at the end and could also generate gap shapes where none of the inputs exist that are completely interior to the outermost boundary.  So if an interest was not in any cutblock it would be included in the output and if any cutblock was not included in any interest, it would be included in the output.

0 Kudos