I have one GeoDataFrame which contains two geometry fields - one is polygon and one is the polygon centroids. The table has also other fields.
I have run spatial join between the gdf and another shapefile of the regions (e.g the shapefile has many polygons of different regions). I have used "op='within' in order to speed it up (and it did):
join=gpd.sjoin(gdf, regions, how='left',op='within')
The problem is that the join didn't work when the polygons touched the borders of the regions' polygons.
I believe that if I would use the centroids instead of the full polygons, I could get better results.
Is it possible to tell GeoPandas which geometry column to use?
I have tried to use the set geometry, then do the spatial join and then change it as well:
df.set_geometry('centroids') join=gpd.sjoin(df, regions, how='left',op='within') join=join.set_geometry('geometry')
but I still got the same results.