I'm working on a python script whose goal is to detect if a point is out of a row of points (gps statement from an agricultural machine). To do this, my idea is to make a buffer around the 10 points around considered point (five before and five after). After that detect if my point is in the buffer. I'm stuck with 'GeoSeries' object has no attribute '_geom'
Here is my code for this part:
for i, row in src.iterrows():
# Tague les points trop éloignés du rang en cours
imin, imax = getMinMax(i, nl, 5) # Retourne les 5eme voisins avant et apres
buddies = src.loc[imin:imax, 'geometry'].drop([i], axis=0) # DF des voisins de i avec uniquement la geometrie
buddies_buf = buddies.buffer(ird*1.2) # Tampon avec un rayon egal a la distance inter rang + 20%
buddies_buf = buddies_buf.unary_union # Fusionne tous les tampons
buddies_buf = gpd.GeoDataFrame(gpd.GeoSeries(buddies_buf)).rename(columns={0: 'geometry'}).set_geometry('geometry') # Formate le tampon en GDF
buddies_buf.crs = crs_work # Attribut le crs
print((row.geometry).within(buddies_buf.geometry))
Somebody can help me?
I don't know if my idea is the best for this kind of detection, so if you have another best idea...