I have df1
and df2
. Each dataframe contains an ID column. Each dataframe also contains a geometry column. I would like to calculate the distance between each dataframe's geometry column only for rows where ID's match in each dataframe.
I would imagine it looks something like this but can't figure it out:
for geom in df1.geometry:
if df1['system_id'] == df2f['systemID']:
df1['distance'] = [geom.distance(df2.geometry[0].boundary) for geom in df1.geometry]