Georeferencing API
    Preparing search index...

    Class GeoreferencerController

    Authoritative editor store with revision-safe processing, edit history and host persistence.

    Construction is SSR-safe and creates no maps or workers. The host supplies the engine, subscribes to stable snapshots and owns final disposal. Files, object URLs and abort controllers remain outside the serializable document.

    Index
    • Commit an enabled pair with a stable ID and a target coordinate snapshot. Invalidates confirmation/review and schedules fitting.

      Parameters

      • image: XY

        Canonical original-resolution pixels.

      • target: XY

        Coordinate in crs.

      • crs: string = ...

        Target CRS; defaults to working CRS.

      • Optionalreference: { featureId?: string; sourceId: string }

        Optional snapping provenance.

        • OptionalfeatureId?: string

          Provider feature identifier when available.

        • sourceId: string

          Identifier of the reference provider used for snapping.

      Returns void

    • Check image bytes, current fit, confirmation, review and accepted geometry validity. Handler availability and drawing bounds are additionally checked by save.

      Returns boolean

    • Confirm exactly the current valid alignment. Enters drawing mode if enabled; existing drawings still require explicit review. Confirmation is not an undoable edit: undo cannot revoke it, and any later alignment edit invalidates it.

      Returns void

    • Suspend and release retained bytes, previews, history and subscriptions. The host separately disposes its engine when no other editor uses it.

      Returns void

    • Run an explicitly configured lazy exporter against a frozen revision snapshot. No format is enabled by default. Lazy-load failures are retryable. Cancellation is observable while loading as well as processing, and stale results are ignored.

      Parameters

      • id: string

        Registered format ID.

      Returns Promise<ExportResult | null>

      Artifacts for the submitted revision, or null on cancelled/stale/failed processing. Missing configuration, ineligible input and concurrent export reject.

    • Return an eligibility explanation, or null when a configured format can run.

      Parameters

      • id: string

      Returns string | null

    • Accepted-geometry errors of the current drawings, computed once per feature revision. Cheap to call during rendering; an empty list means the drawings can be accepted.

      Returns readonly string[]

    • Inspect and select local bytes, guarding unsaved work before replacement. Accepted replacement creates a new document, cancels old jobs and preserves the host map view.

      Parameters

      • file: File

      Returns Promise<boolean>

      True on completion; false on cancellation, supersession or load failure. Errors appear in the snapshot.

    • Navigate bounded image-view history: -1 goes back, 1 goes forward.

      Parameters

      • direction: -1 | 1

      Returns void

    • Cancel the previous fit, fit the current alignment and render its preview. Stale results are discarded; failures update snapshot state rather than reject this promise.

      Returns Promise<void>

    • Guard unsaved work and clear the image, releasing image-dependent resources. Returns false if cancelled or superseded.

      Returns Promise<boolean>

    • Replace all pairs as one undoable alignment edit, for example after .points import. Input is cloned.

      Parameters

      Returns void

      GeoreferenceError For invalid or duplicate points, or more points than the engine budget.

    • Expose an error through the snapshot and host callback. AbortError is ignored.

      Parameters

      • error: unknown

      Returns void

    • Load a full-resolution display image for precise control-point placement, typically once the image view is zoomed beyond the preview resolution. Idempotent while loading or loaded. Unrotated PNG, JPEG and WebP files are displayed directly; other inputs are normalized by the engine within its budgets. Failures are reported but never block editing, and are not retried for the same image.

      Returns Promise<void>

    • Restore a validated session using matching original bytes. SHA-256, dimensions and orientation must match; current unsaved work is guarded.

      Parameters

      • text: string
      • file: File

      Returns Promise<boolean>

      Whether restoration completed. Invalid JSON/schema rejects before replacement; image mismatch appears in the snapshot.

    • Mark current drawings reviewed against the confirmed fit. Does not move or save them. Like confirmation, review is not an undoable edit.

      Returns void

    • Submit a frozen revision snapshot to the host.

      A call for the same document, revision and kind as the in-flight save shares its promise; any other call waits for the in-flight save to settle and then submits its own snapshot. Retries for the same document/revision/kind reuse the request ID. Older request success acknowledges only that revision, leaving newer edits dirty. Draft saves can preserve unconfirmed work; accepted-feature saves require current confirmation, review and valid geometry.

      Parameters

      • kind: "draft" | "features" = "features"

        features (default) or draft, selecting the host callback.

      Returns Promise<void>

      GeoreferenceError For missing handlers or ineligible features. Host rejections propagate and retain the draft.

    • Change transient overlay opacity/visibility without document history.

      Parameters

      • patch: { opacity?: number; visible?: boolean }
        • Optionalopacity?: number

          Overlay opacity from 0 to 1.

        • Optionalvisible?: boolean

          Whether the overlay is shown.

      Returns void

    • Replace geographic drawings as one undoable edit in drawing mode. Requires stable string IDs and JSON properties; topology errors remain editable but block accepted saving.

      Parameters

      Returns void

    • Install or clear the unsaved-work guard. The ready-made editor installs its own dialog guard while mounted.

      Parameters

      • guard: ((context: GuardContext) => Promise<"save" | "discard" | "cancel">) | undefined

      Returns void

    • Set a canonical-pixel [x, y, width, height] viewport with positive dimensions. Debounced view history is separate from document undo.

      Parameters

      • view: [number, number, number, number]

      Returns void

    • Configure one-way image/map navigation without modifying alignment.

      Parameters

      • linkedNavigation: "off" | "image-to-map" | "map-to-image"

      Returns void

    • Set or cancel the image endpoint of an unfinished pair. Requires image bytes and alignment mode.

      Parameters

      • point: XY | null

      Returns void

    • Change preview policy without editing the document. Switching to manual cancels an in-flight preview; switching to automatic fits the current complete pairs when the selected model has enough enabled points. Full rank/domain validation remains in the worker. Valid existing results are retained.

      Parameters

      Returns void

    • Change fitting CRS while preserving GCP target CRSs and geographic drawings. Requires alignment mode.

      Parameters

      • crs: string

      Returns void

    • Subscribe to snapshot changes; returns an unsubscribe function suitable for React useSyncExternalStore.

      Parameters

      • callback: () => void

      Returns () => void

    • Cancel image/fit/export work and revoke the preview and detail URLs, retaining document and source bytes for remount. Pending host saves are not cancelled.

      Returns void

    • Edit either endpoint, target CRS or enabled state by ID. Requires alignment mode and invalidates the fit; unknown IDs are ignored.

      Parameters

      • id: string
      • patch: Partial<Pick<Gcp, "image" | "target" | "crs" | "enabled">>

      Returns void

      GeoreferenceError For nonfinite coordinates or an empty CRS.

    • Replace host-defined JSON properties, preserving identity and geometry. Unknown IDs are ignored.

      Parameters

      • id: string
      • properties: Record<string, unknown>

      Returns void

    Host configuration. Use setGuard to change the transition guard; other options should remain stable.