semantique.extent.SpatialExtent.rasterize#
- SpatialExtent.rasterize(resolution, crs=None)[source]#
Rasterize the spatial extent into an array.
Rasterizing the spatial extent creates a rectangular two-dimensional regular grid that covers the bounding box of the extent. Each grid cell corresponds to a spatial location within this bounding box. Cells that do not intersect with the extent itself get assigned a value of 0. Cells that do intersect with the extent itself get assigned a positive integer, depending on which of the features in the extent they intersects with, i.e. a 1 if they intersect with the first feature in the extent, a 2 if they intersect with the second feature in the extent, et cetera.
- Parameters:
resolution (
list
) – Spatial resolution of the grid. Should be given as a list in the format [y, x], where y is the cell size along the y-axis, x is the cell size along the x-axis, and both are given asint
orfloat
value expressed in the units of the CRS. These values should include the direction of the axes. For most CRSs, the y-axis has a negative direction, and hence the cell size along the y-axis is given as a negative number.crs (optional) – Coordinate reference system in which the grid should be created. Can be given as any object understood by the initializer of
pyproj.crs.CRS
. This includespyproj.crs.CRS
objects themselves, as well as EPSG codes and WKT strings. IfNone
, the CRS of the extent itself is used.
- Returns: