Shapely added an exclusive=True/False keyword to the STRTree nearest method to optionally "exclude the input geometry from the results", see shapely/shapely#1166
The implementation in Shapely currently checks for this based on the "equals" spatial predicate, so it is not necessarily strictly excluding the "input geometry", but any geometry that is spatially equal (so can even have different coordinates).
(more in general it's of course not possible to exactly exclude the input geometry, unless we would check for exact object identity (same pointer))
Shapely added an
exclusive=True/Falsekeyword to the STRTreenearestmethod to optionally "exclude the input geometry from the results", see shapely/shapely#1166The implementation in Shapely currently checks for this based on the "equals" spatial predicate, so it is not necessarily strictly excluding the "input geometry", but any geometry that is spatially equal (so can even have different coordinates).
(more in general it's of course not possible to exactly exclude the input geometry, unless we would check for exact object identity (same pointer))