# catalog/operations/vector/centroid.yaml

id: vector_centroid
name: Centroid
description: >
  Compute the centroid (geometric center) of vector geometries. Returns
  point features representing the center of each input geometry.
version: 1.0.0
category: vector
type: vector-to-vector
default_implementation: native

inputs:
  - name: geometry
    type: vector
    format: geojson
    description: Input vector geometry (polygon, line, or multipart)
    required: true

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

outputs:
  - name: centroid
    type: vector
    format: geojson
    geometry: Point
    description: Centroid point features

params: {}

cache_policy:
  ttl_days: 30
  invalidate_on: [source_update]

# 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:
  python:
    function: geo.vector.centroid
    dispatch: folia/compute.py _BUILTIN_OP_MAP

display_hints:
  map:
    renderer: maplibre
    type: circle
    paint:
      circle-radius: 5
      circle-color: "#FF69B4"

ui:
  icon: target
  color: "#FF69B4"
