> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skyvexsoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.

# useLandingAnalysis

> Access landing analysis data in real-time.

`useLandingAnalysis` provides real-time access to touchdown detection, bounce counting, and settled landing analysis. It hydrates from `GET /api/simulator/landing-analysis/snapshot` on mount, then updates on `flight:landing` Socket.io events. The hook only re-renders when a landing-relevant event occurs — not on every simulator data tick.

Landing data resets automatically when a new tracking session starts.

## Import

```ts theme={null}
import { useLandingAnalysis } from "@skyvexsoftware/stratos-sdk";
```

## Signature

```ts theme={null}
function useLandingAnalysis<TSelected = LandingAnalysisSnapshot>(
  options?: UseLandingAnalysisOptions<TSelected>,
): UseLandingAnalysisReturn;

type UseLandingAnalysisOptions<TSelected = LandingAnalysisSnapshot> = {
  select?: (snapshot: LandingAnalysisSnapshot) => TSelected;
};

type UseLandingAnalysisReturn = {
  landingRate: number | null;
  bounceCount: number;
  touchdowns: BounceData[];
  isOnGround: boolean;
  approachData: CapturePoint | null;
  landingAnalysis: LandingAnalysis | null;
  isLoading: boolean;
};
```

## Parameters

| Parameter        | Type                                               | Description                                                |
| ---------------- | -------------------------------------------------- | ---------------------------------------------------------- |
| `options.select` | `(snapshot: LandingAnalysisSnapshot) => TSelected` | Selector to subscribe to a specific subset of landing data |

## Return value

| Field             | Type                      | Description                                                                       |
| ----------------- | ------------------------- | --------------------------------------------------------------------------------- |
| `landingRate`     | `number \| null`          | Final landing rate in feet per minute (negative = descent). `null` until settled. |
| `bounceCount`     | `number`                  | Number of bounces detected on the current landing sequence                        |
| `touchdowns`      | `BounceData[]`            | Array of all touchdown events for the current landing                             |
| `isOnGround`      | `boolean`                 | Whether the aircraft is currently on the ground                                   |
| `approachData`    | `CapturePoint \| null`    | Snapshot of flight parameters captured at approach                                |
| `landingAnalysis` | `LandingAnalysis \| null` | Full analysis object populated after a settled landing                            |
| `isLoading`       | `boolean`                 | `true` during the initial REST fetch                                              |

## Types

### `BounceData`

Each entry in `touchdowns` represents one touchdown contact. See [`BounceData`](/sdk/type-reference#bouncedata) for the full shape.

### `CapturePoint`

Approach data captured when the aircraft enters the final approach phase. See [`CapturePoint`](/sdk/type-reference#capturepoint) for the full shape.

### `LandingAnalysis`

Populated after the aircraft settles (weight on wheels stabilizes). See [`LandingAnalysis`](/sdk/type-reference#landinganalysis) for the full shape (includes the nested [`GateCapture`](/sdk/type-reference#gatecapture) snapshot at \~50 ft AGL).

## Usage

### Display landing rate after touchdown

```tsx theme={null}
import { useLandingAnalysis } from "@skyvexsoftware/stratos-sdk";

export function LandingCard() {
  const { landingRate, bounceCount, isOnGround, isLoading } =
    useLandingAnalysis();

  if (isLoading) return <p>Loading...</p>;

  if (!isOnGround && landingRate === null) {
    return <p>Awaiting touchdown</p>;
  }

  return (
    <div>
      {landingRate !== null && (
        <p>Landing rate: {Math.round(landingRate)} fpm</p>
      )}
      {bounceCount > 0 && <p>Bounces: {bounceCount}</p>}
    </div>
  );
}
```

### Show detailed analysis after settling

```tsx theme={null}
const { landingAnalysis, touchdowns } = useLandingAnalysis();

if (landingAnalysis) {
  return (
    <div>
      <p>Rate: {Math.round(landingAnalysis.landingRateFpm)} fpm</p>
      <p>G-force: {landingAnalysis.touchdownGForce.toFixed(2)}g</p>
      <p>Bounces: {landingAnalysis.bounceCount}</p>
    </div>
  );
}
```

## Notes

* `landingRate` is `null` until a settled landing is detected. During a bounce sequence it updates per bounce.
* The `select` option is passed directly to TanStack Query's structural sharing. The component will not re-render if the selected value is deeply equal to the previous value.
* Landing data resets when `FlightEventPipeline.startTracking()` is called at the beginning of a new flight — previous session data is not preserved across flights.
