A point in a raster class

Utilities to work with points in a raster

class PointInRaster(raster, affine, x, y)[source]

Class denoting a point in a raster. This a wrapper around class rasterstats.point optimizing some operations, primarily the bilinear interpolation

See also https://pythonhosted.org/rasterstats/_modules/rasterstats/point.html

COMPLETELY_MASKED = 1
PARTIALLY_MASKED = 2
window

Window representing 2x2 window whose center points encompass point

x

X coordinate of the point

y

Y coordinate of the point

is_masked() bool[source]
array(raster)[source]
bilinear(raster) Optional[float][source]

An optimized version of rasterstats.point function: given a point’s window as 2x2 array, and x, y as its coordinates, treat center points as a unit square.

e.g.: Center of A is at (0, 1) on unit square, D is at (1, 0), etc

Parameters

raster – Raster, to which the point belongs

Returns

the value for the fractional row/col using bilinear interpolation between the cells