⚠️ Our 0.1 release refactored several early-development functions for long-term stability, to update your code see here. ⚠️
Future changes will come with deprecation warnings! 🙂

Metric buffer and without overlap

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.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.buffer_metric(buffer_size=500)

Let’s plot the raster and vector

ax = vect.plot()
vect_buff.plot(ec="k", fc="none")
buffer voronoi

Many buffers are overlapping. To compute a buffer without overlap, one can use buffer_without_overlap().

vect_buff_nolap = vect.buffer_without_overlap(buffer_size=500)
vect_buff_nolap.plot(ec="k", fc="none")
buffer voronoi

We plot with color to see that the attributes are retained for every feature.

vect_buff_nolap.plot(ax="new", column="Area")
vect.plot(ec="k", column="Area", alpha=0.5)
buffer voronoi

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

Gallery generated by Sphinx-Gallery