⚠️ 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! 🙂

geoutils.Raster.interp_points

geoutils.Raster.interp_points#

Raster.interp_points(points, method='linear', band=1, input_latlon=False, shift_area_or_point=None, force_scipy_function=None, **kwargs)[source]#

Interpolate raster values at a set of points.

Uses scipy.ndimage.map_coordinates if the Raster is on an equal grid, otherwise uses scipy.interpn on a regular grid.

Optionally, user can enforce the interpretation of pixel coordinates in self.tags[‘AREA_OR_POINT’] to ensure that the interpolation of points is done at the right location. See parameter description of shift_area_or_point for more details.

Parameters:
  • points (tuple[list[float], list[float]]) – Point(s) at which to interpolate raster value. If points fall outside of image, value returned is nan. Shape should be (N,2).

  • method (Literal['nearest', 'linear', 'cubic', 'quintic']) – Interpolation method, one of ‘nearest’, ‘linear’, ‘cubic’, or ‘quintic’. For more information, see scipy.ndimage.map_coordinates and scipy.interpolate.interpn. Default is linear.

  • band (int) – Band to use (from 1 to self.count).

  • input_latlon (bool) – Whether the input is in latlon, unregarding of Raster CRS

  • shift_area_or_point (bool | None) – Whether to shift with pixel interpretation, which shifts to center of pixel coordinates if self.area_or_point is “Point” and maintains corner pixel coordinate if it is “Area” or None. Defaults to True. Can be configured with the global setting geoutils.config[“shift_area_or_point”].

  • force_scipy_function (Optional[Literal['map_coordinates', 'interpn']]) – Force to use either map_coordinates or interpn. Mainly for testing purposes.

Returns rpoints:

Array of raster value(s) for the given points.

Return type:

ndarray[Any, dtype[Union[floating[Any], integer[Any]]]]