New answers tagged

4 votes

Dropping nearly-identical point locations with GeoPandas

You can round the coordinates of the geometries first using shapely.set_precision: # Round the coordinates to 5 decimals gdf.geometry = shapely.set_precision(gdf.geometry, grid_size=0.00001) Note: in ...
Pieter's user avatar
  • 1,602
-1 votes

Dropping nearly-identical point locations with GeoPandas

Alongside with a possible solution suggested in NielsFlohr's answer. I would like to suggest an option where one does not need to split point's geometry into x and y-coordinates. It is primarily based ...
Taras's user avatar
  • 32.8k
2 votes

Dropping nearly-identical point locations with GeoPandas

You can round off the coordinates to a desired precision level, which is not obvious with geopandas. See here. from shapely.ops import transform def round_coordinates(geom, ndigits=2): def ...
Shawn's user avatar
  • 1,757
4 votes

Dropping nearly-identical point locations with GeoPandas

You could just create new columns based on your point geometry, round it, and then use drop_duplicates(), e.g.: gdf["x"] = round(gdf.geometry.x, 5) gdf["y"] = round(gdf.geometry.y, ...
NielsFlohr's user avatar

Top 50 recent answers are included