Group by Proximity Group_ID reassignment

191
2
Jump to solution
02-07-2024 08:38 AM
GIGuy
by
New Contributor II

Hello all,

I am having trouble with reassigning GroupIDs. 

For my project, I have two feature classes: a basic points layer and a collection of geolocated images.

GIGuy_0-1707321614346.png

 

As you can tell, there are 4 images for every point. I am trying to create a field in the images that matches the objectID of the points. I have already done this through buffers and have confirmed that it would work. However, I also need to test if I can group the images temporally.

From what I can tell, the only way to do this is through the Group by Proximity tool (if there is a better way to do this please let me know!). With a little bit of tinkering the tool can group the images into three groups. However, how they are aggregated into those groups is out of my control. For instance, while I only need three groups, the tool creates many more and (I believe) assigns them to the most reasonable one.

GIGuy_1-1707322433016.png

Luckily, these IDs are still in chronological order so if the point feature is collected in the same order as the images, the subsequent "adding attachments" will be a walk in the park. I need to find a way to rank these values and calculate the field as that rank.

Ex.

GIGuy_3-1707322630796.png

 

I'd appreciate any advice and insight!

 

 

0 Kudos
1 Solution

Accepted Solutions
GIGuy
by
New Contributor II

 Never mind guys, I realized I was the GIGuy.

rank = 0
rank_value = 0
def ranked(x):
    
    global rank
    global rank_value
    
    newValue = x
    
    if newValue == rank_value:
        return(rank)
    else:
        rank_value = newValue
        rank = rank + 1
        return(rank)

 

View solution in original post

0 Kudos
2 Replies
GIGuy
by
New Contributor II

 Never mind guys, I realized I was the GIGuy.

rank = 0
rank_value = 0
def ranked(x):
    
    global rank
    global rank_value
    
    newValue = x
    
    if newValue == rank_value:
        return(rank)
    else:
        rank_value = newValue
        rank = rank + 1
        return(rank)

 

0 Kudos
GIGuy
by
New Contributor II

In all seriousness though, this only works when it's in order

0 Kudos