From ee8adfb27659e9f982ba8cdadbf62c6b36dcc053 Mon Sep 17 00:00:00 2001 From: ryanward-io Date: Sun, 12 Dec 2021 02:43:18 +1100 Subject: [PATCH] DOC: Added sjoin_nearest method to examples gallery. (#2259) --- doc/source/gallery/spatial_joins.ipynb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/source/gallery/spatial_joins.ipynb b/doc/source/gallery/spatial_joins.ipynb index 38f06e3..81f79a0 100644 --- a/doc/source/gallery/spatial_joins.ipynb +++ b/doc/source/gallery/spatial_joins.ipynb @@ -213,6 +213,24 @@ "source": [ "pointdf.sjoin(polydf, how=\"left\", predicate=\"within\")" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can also conduct a nearest neighbour join with `sjoin_nearest`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "pointdf.sjoin_nearest(polydf, how=\"left\", distance_col=\"Distances\")\n", + "# Note the optional Distances column with computed distances between each point\n", + "# and the nearest polydf geometry." + ] } ], "metadata": {