Wednesday, 10 April 2019

arcpy - Concatenating Attributes of Points in Same Location using ArcGIS for Desktop?


I have a single feature class that contains multiple points with the same location, but different names and text attributes, and I would like to concatenate the attributes together and merge the points down to a single point.


So a dataset like this:




+----+-----+-----+------+-----------+------------+
| ID | Lat | Lon | Name | Atribute1 | Attribute2 |
+----+-----+-----+------+-----------+------------+
| 1 | 60 | 60 | a | a | q |
| 2 | 60 | 60 | b | a | r |
| 3 | 61 | 61 | c | a | s |
| 4 | 62 | 62 | d | b | t |
| 5 | 62 | 62 | e | b | u |
| 6 | 62 | 62 | f | b | v |

| 7 | 63 | 63 | g | c | w |
| 8 | 64 | 64 | h | c | x |
| 9 | 65 | 65 | i | c | y |
| 10 | 65 | 65 | j | d | z |
+----+-----+-----+------+-----------+------------+

I want it to end up something like this:



+----+-----+-----+---------+-----------+------------+
| ID | Lat | Lon | Name | Atribute1 | Attribute2 |

+----+-----+-----+---------+-----------+------------+
| 1 | 60 | 60 | a, b | a | q, r |
| 3 | 61 | 61 | c | a | s |
| 4 | 62 | 62 | d, e, f | b | t, u, v |
| 7 | 63 | 63 | g | c | w |
| 8 | 64 | 64 | h | c | x |
| 9 | 65 | 65 | I, j | c, d | y, z |
+----+-----+-----+---------+-----------+------------+

I have tried a bunch of different methods to do things like run summary statistics, but that only does numbers or first/last not a concatenate.



I am currently working on ideas as to how to script it out in python, but I was hoping there is a tool which I am missing that will do this already. I am also not sure on what the best route to script it is either. I was thinking about looping through the original dataset, select by location, concatenate all the fields, and put them into the first point while deleting the rest. But not sure that would be the right method.




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...