Note
Go to the end to download the full example code.
Metric buffer and without overlap#
This example demonstrates the metric buffering of a vector using buffer_metric() and buffer_without_overlap().
We open an example vector
import geoutils as gu
filename_vect = gu.examples.get_path("everest_rgi_outlines")
vect = gu.open_vector(filename_vect)
We buffer in metric units directly using buffer_metric(). Under the hood, this functionality reprojects to a local projection,
buffers, and converts back to the original CRS.
vect_buff = vect.vct.buffer_metric(buffer_size=500)
Let’s plot the raster and vector
ax = vect.vct.plot()
vect_buff.vct.plot(ec="k", fc="none")

Many buffers are overlapping. To compute a buffer without overlap, one can use buffer_without_overlap().
vect_buff_nolap = vect.vct.buffer_without_overlap(buffer_size=500)
vect.vct.plot(ax="new")
vect_buff_nolap.vct.plot(ec="k", fc="none")

We plot with color to see that the attributes are retained for every feature.
vect_buff_nolap.vct.plot(ax="new", column="Area")
vect.vct.plot(ec="k", column="Area", alpha=0.5)

Total running time of the script: (0 minutes 8.036 seconds)