Reputation: 1
I have two geopandas dataframe having Point and LineString Geometries.
I want to use spatial joins to combine these dataframes on the basis of the distance between them.
Following are the two geometrical columns I want to use for joining:
[Point Geometry] (https://i.sstatic.net/hPkQw.png)
[LineString] (https://i.sstatic.net/uIWs6.png)
I used sjoin_nearest() function in geopandas to join based on their distance. Following is the line of code I am using for joining:
joined_df = point_gdf.sjoin_nearest(gdf,how='left',distance_col='distances',max_distance=0.06219)
Someone told me that the unit of max_distance is miles so I tried converting 100 meters to miles and then providing the value.
I get the following output:
[Joined Dataframe] (https://i.sstatic.net/pAi6K.png)
Now I am confused about the max_distance parameter in sjoin_nearest().
Upvotes: 0
Views: 303
Reputation: 1949
The distance is in the units of the coordinate system you are using.
By the coordinates it looks like EPSG:4326 which have
Unit: degree (supplier to define representation)
You should not be measuring distances in degrees. 1 degree near the equator will be very different from 1 degree nearer the poles.
Reproject your data into a projected coordinate system with units in for example meters. Like one of the UTM zones.
If your data is in Saudi Arabia you can use EPSG:9357
Upvotes: 0