geoutils.Raster.interp_points#
- Raster.interp_points(points, method='linear', dist_nodata_spread='half_order_up', 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 using “nearest” or “linear” (for speed), 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
[Union
[int
,float
,integer
[Any
],floating
[Any
]],Union
[int
,float
,integer
[Any
],floating
[Any
]]] |tuple
[ndarray
[Any
,dtype
[Union
[floating
[Any
],integer
[Any
]]]],ndarray
[Any
,dtype
[Union
[floating
[Any
],integer
[Any
]]]]]) – Point(s) at which to interpolate raster value (tuple of X/Y array-likes). If points fall outside of image, value returned is nan.method (
Literal
['nearest'
,'linear'
,'cubic'
,'quintic'
,'slinear'
,'pchip'
,'splinef2d'
]) – Interpolation method, one of ‘nearest’, ‘linear’, ‘cubic’, ‘quintic’, ‘slinear’, ‘pchip’ or ‘splinef2d’. For more information, see scipy.ndimage.map_coordinates and scipy.interpolate.interpn. Default is linear.dist_nodata_spread (
Union
[Literal
['half_order_up'
,'half_order_down'
],int
]) – Distance of nodata spreading during interpolation, either half-interpolation order rounded up (default; equivalent to 0 for nearest, 1 for linear methods, 2 for cubic methods and 3 for quintic method), or rounded down, or a fixed integer.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: