The R package ClustGeo implements a Ward-like hierarchical clustering algorithm including spatial/geographical constraints.
Details are available is the following vignette:
https://chavent.github.io/ClustGeo
The package can be installed from GitHub using:
pak::pak("chavent/ClustGeo")If needed, install pak first:
install.packages("pak")