inverse_distance_weighting#

geodesic.boson.inverse_distance_weighting(attribute_name, max_distance, asset_name='idw', input_collection=None, no_data_value=0, power=2, max_points=25, feature_limit=1000)[source]#

Creates an interpolated image from a feature collection using inverse distance weighting.

Inverse distance weighting is a method for interpolating values from a set of points to a raster. This method is useful for interpolating values like temperature, precipitation, or other continuous variables from a set of point measurements.

If the features are not points (e.g. polygons), the centroid of the feature will be used as the point to interpolate from.

Inverse distance weighting takes the k nearest points to a pixel and calculates the value at that pixel as the weighted average of the values of the k nearest points. The weight of each point is calculated as 1 / distance^power, where power is a parameter that controls the rate at which the weight decreases.

The max distance (meters) parameter controls the maximum distance to interpolate to. If there are no points within this distance, the pixel will be set to the no_data_value.

Increasing the feature limit will increase the number of features that are interpolated, but will also increase the time it takes to interpolate the image. There is a hard limit of 10,000 features that can be interpolated.

Parameters:
  • attribute_name (str) – attribute name to interpolate. This is the field in the properties of each feature that will be interpolated.

  • asset_name (str) – name of the asset to create.

  • max_distance (float) – maximum distance to interpolate in meters.

  • input_collection (str | None) – collection to interpolate. Defaults to None (all/default collection).

  • no_data_value (float) – value to use for pixels with no data. Defaults to 0.

  • power (int) – power to use in the interpolation. Defaults to 2.

  • max_points (int) – maximum number of points to use in the interpolation. Defaults to 25.

  • feature_limit (int) – maximum number of features to interpolate. Defaults to 1000.

Examples

>>> # Interpolate the temperature attribute using inverse distance weighting
>>> transform = inverse_distance_weighting(
...     attribute_name="temperature",
...     asset_name="temperature_interpolated",
...     max_distance=100
... )