Note
Go to the end to download the full example code.
Raster to points#
This example demonstrates the conversion of a raster to point vector using geoutils.Raster.to_points()
.
We open a raster.
import geoutils as gu
filename_rast = gu.examples.get_path("exploradores_aster_dem")
rast = gu.Raster(filename_rast)
rast = rast.crop([rast.bounds.left, rast.bounds.bottom, rast.bounds.left + 500, rast.bounds.bottom + 500])
Let’s plot the raster.
rast.plot(cmap="terrain")

We convert the raster to points. By default, this returns a vector with column geometry burned.
We plot the point vector.
pts_rast.plot(ax="new", column="b1", cmap="terrain", legend=True)

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