# catalog/operations/analysis/point_interpolate.yaml

id: analysis_point_interpolate
name: Point Interpolation
description: >
  Returns a 4-neighbor bilinear-interpolated value at each input point.
  Use when sampling a continuous field (DEM, temperature surface, etc.)
  and you want a smoothed sub-pixel value. NaN in any contributing
  neighbor propagates to the result — bilinear cannot produce a clean
  answer if any of the four pixels is invalid.

  For pixel lookup (the standard "what value is at this point" question
  matching QGIS Identify / GEE Image.sample), use `analysis_point_sample`.
version: 1.0.0
category: analysis
type: raster-vector-to-table
default_implementation: native

inputs:
  - name: raster
    type: raster
    format: geotiff
    description: Input raster to sample
    required: true
  - name: points
    type: vector
    format: geojson
    geometry: Point
    description: Sample point locations
    required: true

# Structural: bilinear interpolation works on any continuous raster.
# Output carries the source raster's concept; no concept declared here.

outputs:
  - name: sampled
    type: vector
    format: geojson
    geometry: Point
    description: Points with interpolated raster values as properties

params:
  property_name:
    type: string
    default: value
    description: Name of the property to store interpolated values

cache_policy:
  ttl_days: 30
  invalidate_on: [source_update, points_change]

# backends: audited 2026-08-14 (defect 50). A key means a runtime that DISPATCHES this op —
# folia-engine `dispatch_op` (products/sdk/folia-engine/src/lib.rs), a `registerOp`/OP_TABLE
# entry in packages/compute, `_BUILTIN_OP_MAP` in folia/compute.py, or a backend manifest
# (folia/backends/*/backend.yaml).
backends:
  rust-wasm:
    function: stats_ops::point_sample_bilinear
    handle_function: h_point_sample_bilinear
  js:
    function: analysis_point_interpolate

display_hints:
  map:
    renderer: maplibre
    type: circle
    paint:
      circle-radius: 5
      circle-color: "#FF8DAA"
  table:
    renderer: tanstack-table

ui:
  icon: crosshair
  color: "#FF8DAA"
