5
GeoPandas: Temukan titik terdekat di kerangka data lain
Saya punya 2 geodataframe: import geopandas as gpd from shapely.geometry import Point gpd1 = gpd.GeoDataFrame([['John',1,Point(1,1)],['Smith',1,Point(2,2)],['Soap',1,Point(0,2)]],columns=['Name','ID','geometry']) gpd2 = gpd.GeoDataFrame([['Work',Point(0,1.1)],['Shops',Point(2.5,2)],['Home',Point(1,1.1)]],columns=['Place','geometry']) dan saya ingin mencari nama titik terdekat di gpd2 untuk setiap baris di gpd1: desired_output = Name ID geometry Nearest 0 John 1 POINT (1 1) Home 1 Smith 1 POINT (2 …