Friday 14 July 2017

arcgis desktop - Spaghetti, meatballs, and the one-to-many problem


I am trying to use the Spaghetti and Meatballs overlay technique to create a fire history layer from Cal Fire FRAP's fire perimeter data. I am following the technique Dale Honeycutt describes in his ESRI blog post. However, at the spatial join part, instead of doing a one to one join, I am performing a one to many join. This then gives me multiple points with the same "Target FID" value, but different values for Name and Year of Fire. His next blog then goes into detail on how to combine the points with repeating "Target FID" values into one point with a string of values for both the Name and Year of Fire columns. However, that blog seems to no longer exist.



Essentially what I am trying to do is take data that looks like this:


Target_FID   Fire_Name       Fire_Year
2 Otay 1953
2 Wheeler 1989
2 Thomas 2017

To look like this:


Target_FID   Fire_Name                 Fire_Year
2 Otay_Wheeler_Thomas 1953_1989_2017

Answer




In fact this is a variation of https://gis.stackexchange.com/a/280415/28687, except it requires an additional step and is also answered elsewhere. For completeness sake, I am copying here the Luke's answer:



  1. Union the shapefile with itself (introduce only one input, which is the feature class/layer that you are processing);

  2. Convert multipart output to single part;

  3. Use the spatial join tool by use the ARE_IDENTICAL_TO match option and [Additional step to merge the attributes] by using field mapping option. In your case make sure Fire_Name and Fire_Year fields are String field type and set a relatively large field length (based on the length of the string of attributes once concatenated), say 500. Lastly set your mapping Merge Rule to Join and define underscore as the delimiter (see below a snip from https://esriaustraliatechblog.files.wordpress.com/2015/05/spjoin_05.jpg where the delimiter is ,|).


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...