spatial-data-lab / knime-geospatial-extension

This repository is built for KNIME-CGA Geospatial Project, and the goal is to build Python-based nodes for geospatial analysis in KNIME Analytic Platform.
MIT License
25 stars 10 forks source link

Nearest Join Node Add Exclusive Option from sjoin_nearest #307

Closed rrousselot closed 6 months ago

rrousselot commented 10 months ago

I am having issues using the Nearest Join node because it only returns 1 item. I am searching for proximity to nearest point that is not the current point I am at. As it works now if the same point is in the dataset, you get a zero-distance returned and the record for the same point you are searching with. I need the nearest point that is not the current point. I think this can be solved by exposing the GeoPandas sjoin_nearest  parameter exclusive to the nodes settings. I believe this is currently always set to false. Please make it possible to set this parameter in the Nearest Join node settings.

https://geopandas.org/en/stable/docs/reference/api/geopandas.GeoDataFrame.sjoin_nearest.html#geopandas.GeoDataFrame.sjoin_nearest

exclusive bool, optional, default False If True, the nearest geometries that are equal to the input geometry will not be returned, default False. Requires Shapely >= 2.0

koettert commented 10 months ago

@UrbanGISer can you please check if this option solves the problem. If this is the case we could expose it with the next release as advanced setting.

rrousselot commented 10 months ago

FWIW I used a Python Script node to set the exclusive to True in sjoin_nearest and it worked the way I needed it to.

koettert commented 10 months ago

Perfect, thanks for the info @rrousselot . Will add the ticket to the next release