How to merge geoseries to geodataframe based on geometry attribute

by Suhendra   Last Updated June 13, 2019 08:22 AM

I have a geodataframe with 5868 rows that have some columns/attributes, including geometry. I have filtered the geodataframe using the geometry attribute with some conditions, but the result is just the geoseries with 5321 rows (reduced from the original data) of geometry attributes. How to merge the geoseries in order to create geodataframe with row size after filtering (5321 rows).

ships = gpd.read_file(r"D:\Suhendra\Riset BARATA\data ais\lego_python\kepri_201812_ship.shp") #'ships' is geodataframe with some columns #remove the 'ships' geometry that have less than 10 m distance each other point_nodes = list(ships['geometry']) for i in range(len(point_nodes) - 1): if point_nodes[i] is None: continue for j in range(i + 1, len(point_nodes)): if point_nodes[j] is None: continue if point_nodes[i].distance(point_nodes[j]) < d: point_nodes[j] = None new_point_nodes = gpd.GeoSeries([node for node in point_nodes if node is not None]) #'new_point_nodes' is just geoseries with geometry infomation

I want to merge the 'new_point_nodes' geoseries to 'ships' geodataframe with row size after filtering with above condition



Related Questions


Updated May 08, 2019 00:22 AM

Updated April 01, 2019 14:22 PM

Updated January 09, 2018 11:22 AM

Updated January 25, 2018 15:22 PM