Best way to find compare attribute value changes in road centerlines

220
3
01-25-2021 02:14 PM
MichaelBouvet
New Contributor

Hello Everyone!

I am tasked with updating our road centerline feature class regularly, and I am trying to find the most efficient way to detect and compare changes in attributes values. 

My ideal:

A workflow/tool that will let me detect the segments that have attribute value changes, and allow me to easily compare those changes to make sure those changes are valid. 

Things to Note:

  • I am using ArcGIS Pro 2.7.0. 
  • We get our updated road centerlines from the same source, with the same schema
  • There is a shared ID between the two datasets (roadsegID) that can be used for joins

So far I have tried: 

  • Feature Compare tool
    • Issue: I can't get it to compare the rows correctly. I put in the roadsegID as the sort field, but it does not the rows based off that field. 
  • Detect Feature Changes
    • Issue: It does not directly say which specific fields have value differences, making it less efficient.

Please let me know if you have good suggestions!

Thank you, 

Michael

 

3 Replies
jcarlson
Regular Contributor

How comfortable are you with Python? The Pandas module has a compare() function to compare datasets that works well for situations like this.

- Josh Carlson
Kendall County GIS
MichaelBouvet
New Contributor

I am halfway through a certificate in python, so I am willing to try it!

Reply
0 Kudos
jcarlson
Regular Contributor

You could probably start testing it out in an AGOL Notebook. Check out the compare() docs for reference. The two input datasets have to have the same length in order to be compared, but that's pretty easy to do in Pandas.

 

import pandas as pd

df1 = pd.DataFrame('old-data-source')
df2 = pd.DataFrame('new-data-source')

for df in [df1, df2]:
    df.set_index('roadsegID', inplace=True)

# Optional section in case there are different row counts between the frames
df1 = df1[df1.index.isin(df2.index.to_list())]
df2 = df2[df2.index.isin(df1.index.to_list())]

# Compare frames
comp = df1.compare(df2)

comp

 

That'll spit out a dataframe of rows which have difference in some column and columns which have a difference in some row. Good luck!

I should say, too, that there are more elegant ways to handle that optional section, but not knowing your schema or data, I went with that. As you test things out, you'll figure out the way you like to do it.

- Josh Carlson
Kendall County GIS