# catalog/operations/vector/clip.yaml

id: vector_clip
name: Clip Features
description: >
  Clip vector features to a mask geometry. Features are cut to the mask
  boundary and only the portions inside the mask are retained.
version: 1.0.0
category: vector
type: vector-to-vector
default_implementation: native

inputs:
  - name: features
    type: vector
    format: geojson
    description: Input vector features to clip
    required: true
  - name: mask
    type: vector
    format: geojson
    description: Clipping mask geometry (polygon)
    required: true

# Structural op — operates on any vector geometry uniformly.
requires: {}

outputs:
  - name: clipped
    type: vector
    format: geojson
    description: Clipped vector features

params: {}

cache_policy:
  ttl_days: 30
  invalidate_on: [source_update, mask_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:
  js:
    function: vector_clip
  python:
    function: geo.vector.clip
    dispatch: folia/compute.py _BUILTIN_OP_MAP

display_hints:
  map:
    renderer: maplibre

ui:
  icon: scissors
  color: "#DC143C"
