0

I have several different point feature classes (shape files) spread on a grid, each point (located at grid centers) has a attribute named value. For example, assume we have a 3x3 grid, which has nine point features at the grid centers. The first point feature class is the four lower left ones with value = 1, and the second point feature class is the four upper right ones with value = 2. Now I want to merge these two feature classes, and get a new feature class with seven (not eight) points and with value being sum of the first and second one, as indicated in below picture.

How can I do it in ArcGIS?

I tried Merge or append tools in ArcGIS but it will not add values the way I want.

enter image description here

  • If you added a text column then populated it with x & y concatenated, it seems like the problem could be handled nonspatially with SQL union then group by. – Kirk Kuykendall Oct 10 '18 at 2:30
  • I am using ArcGIS, and tried Merge and Append tools but it don't work this way. I need to do it spatially. I am working on some maps. I was thinking that it should have a straightforward solution in ArcGIS. – Shahriar49 Oct 10 '18 at 11:20
  • Yes, I said a grid and points on their centers, so the figure should be obvious. In the other question you mentioned the solution was by spatial join, not merge tool. But I want a silution based on merge tool in ArcGIS. I tried this tool but the result was not as I expected, so I made this question to emphasize on a solution by merge tool. – Shahriar49 Oct 11 '18 at 3:21
2

You will need to merge all the points first using the merge tool. Then use spatial join to sum the values. In the spatial join tool, you need to create a new field and map to it using 'Add Input Field'. Add the field from each layer as an input field. Set the merge rule set to 'Sum'. Set the match option to "ARE_IDENTICAL_TO"

enter image description here

enter image description here

enter image description here

  • I did exactly the same thing, but it does not work in the way it should be. I mean, I expect from the merge (when I specify a sum rule) to add the values at the same point together and create a single feature instead of previous two ones. But the merge tool just copies two overlapping feature points to the output without summing. I checked the merge help page as well, and it says "This tool will not split or alter the geometries from the input datasets. All features from the input datasets will remain intact in the output dataset, even if the features overlap". – Shahriar49 Oct 11 '18 at 13:02
  • The merge tool works exactly like it says it will work in the documentation. You seem to be set upon using ONLY the merge tool even though that is not appropriate for what you are trying to achieve. The best solution I can see uses the merge tool followed by spatial join. – jbalk Oct 11 '18 at 18:06
  • The merge rules are available in the merge tool in case you are mapping multiple fields from the input to one new field in the output. – jbalk Oct 11 '18 at 18:09
  • Or just use FelixIP solution. It will accomplish what you're trying to do. – jbalk Oct 11 '18 at 18:12
  • Thank you. I see that I can not use just the merge tool. That is OK and I know what to do based on the received guidelines. But I am still a bit confused. You say the merge rules are used in case I am "mapping multiple fields from the input to one new field in the output". I was also doing the same thing, adding two fields from two different inputs and set the merge rule to sum, but it doesn't work and just copies the input features to the output without any summation. So what is the point in defining the rules in merge tool when it just copies the features from both inputs to the output? – Shahriar49 Oct 11 '18 at 22:39
3

Solution below is essentially the one suggested by @Kirk Kuykendall to the same question of yours.

INPUT:

enter image description here

WORKFLOW:

arcpy.AddGeometryAttributes_management("A", "POINT_X_Y_Z_M")
arcpy.AddGeometryAttributes_management("B", "POINT_X_Y_Z_M")
arcpy.Merge_management(inputs="A;B", "../A_Merge")
arcpy.Dissolve_management("A_Merge", ".../A_Merge_Dissolve1",
                          dissolve_field="POINT_X;POINT_Y",
                          statistics_fields="Z SUM", multi_part="SINGLE_PART")

OUTPUT:

enter image description here

  • Thanks for reply. But I was wondering what is the use of merge rules (particularly sum rule) in merge tool. It make much more sense to just tell the tool to use the sum rule and it will sum the overlapping feature values. Why it doesn't work this way? And then what is the purpose of providing sum (or other rules) in merge when they don't work this way? – Shahriar49 Oct 11 '18 at 13:04
0

You should do a spatial joint, if you use the tool from the toolbox there are field mapping option where you can right click on a field name and define how the value of overlapping feature are aggregated (in your case choose SUM, but MAX, MIN, MEAN, FIRST, LAST, and other are available)

Also if your point are not exactly at the same position you could set a search distance (be careful not to set it to high) to ensure that almost overlapping point are aggregated

EDIT : The spatial join will not output all 7 point but only the 4 from the target layer (3 original + 1 being the sum of the two overlapping point) but the append tool have the same field mapping option so you could try to set it to sum (or total depending of the version) and see if that work

  • Thanks for comment. The Append tool is not working in my case, because it will add new features to the existing one, so the number of features will be 8, and I found no way to merge two points in the same location and add their values. It has a 'sum' option in merge rules but it was not possible to include both layers' value fields in the field mapping section. I don't understand what is the use of merge rules. They do nothing on merging values at the same location at all. Or maybe I am doing something wrong? I appreciate any advice. – Shahriar49 Oct 10 '18 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.