# USACE Inland Waterway Transit Constraint Resolver (`rhincodontypus/usace-waterway-transit-constraint-resolver`) Actor

Check a U.S. inland-waterway route against current USACE navigation notices and lock operating data. Returns geometry-confirmed restrictions, affected locks, reported delays, temporal status, route order and official provenance as structured data for AI agents.

- **URL**: https://apify.com/rhincodontypus/usace-waterway-transit-constraint-resolver.md
- **Developed by:** [Jonathan Brown](https://apify.com/rhincodontypus) (community)
- **Categories:** Travel, Automation
- **Stats:** 2 total users, 1 monthly users, 93.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $100.00 / 1,000 waterway route checks

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## USACE Inland Waterway Transit Constraint Resolver

You supply an inland-waterway route. The Actor checks it against official U.S. Army Corps of Engineers (USACE) navigation information and returns one structured record. The record covers:

- **Navigation notices (NTNI)** whose published geometry intersects the route corridor, with official text (verbatim, cut at about 1,000 characters when longer, with `officialTextTruncated` and `officialTextLength`), temporal status and route position.
- **USACE locks** within the corridor, in route order, with the official river and lock codes, river mile and chambers.
- **Lock operating conditions** reported by LPMS: vessels pending, vessels locking, the reported 4-hour average delay, lockages in the last 24 h, stall stoppages and gauges. Each comes with a freshness label. Where LPMS answers "Data Unavailable" for a river (e.g. Columbia, Snake), locks are listed with `operatingConditionsStatus: "not_published_for_river"`, LPMS coverage is `not_published_for_river` and the result is `partial`: lock conditions are unknown, not a source failure.
- **`unverifiedLocationNotices`**: active notices from USACE districts within 25 nm of the corridor that publish no geometry. They are retained with their original river-mile wording and the parsed miles, but are **not** route matches. Each entry is compact: ID, title, dates and temporal status, location text, district, waterway and its official NTNI record URL, without the notice text. At most 25 are itemised; `unverifiedNoticeListing` gives the total, whether the list is truncated, and every notice ID by district.
- **Coverage** for every source, so incomplete checks are explicit.

The record opens with `status`, `summary` (confirmed match count, unverified notice count, how many are listed), `billing` and `coverage` (with a deterministic coverage note), so the decision-critical facts come first. A normal record stays well under 60,000 characters even on notice-heavy routes. The uncut record, with every unverified notice and its full official text, is in the run's default key-value store under `FULL_RESULT` (`fullRecordKey`).

### What it does not do

- It does not plan routes. The route is yours, and the corridor (default 1 nm each side) must cover the channel you mean.
- It makes no safety, passage or clearance determination and is not navigational advice. A zero-match result means only: *"No matching constraints were found in the official datasets successfully checked."*
- It does not predict delays. Queue and delay values are LPMS's reported values at retrieval time.
- It does not match by river mile in v1. That would require mapping each mile marker to your route deterministically.

### Official sources

| Source | Endpoint | Used for |
|---|---|---|
| NTNI active notices | `ndc.ops.usace.army.mil/ords/ntni/json_data/notices/{DDMMYYYY}` | Active notice set, official text, dates |
| NTNI notice detail | `.../ntni/leaflet_json/notice/{id}` (404 = no geometry published) | Notice geometry, begin/end timestamps |
| NTNI GeoJSON feed | `.../ntni/json_data/notices_geoJson/{DDMMYYYY}` | Upcoming notices with geometry |
| USACE Civil Works districts | ArcGIS `usace_cw_districts` | Which geometry-less notices to list as nearby |
| USACE Locks | ArcGIS `Locks/FeatureServer/0` | Lock locations and identifiers |
| LPMS | `ndc.ops.usace.army.mil/ords/lpms/json/lock_status_report` | Current lock operating conditions |

### Semantics

- **Temporal status:**
  - `active`, `upcoming` and `expired` come from official dates or timestamps.
  - `active_by_source` is a notice with no end date that the official active-notices service still returns. USACE asserts it is active; it is not derived from an end date and has not been verified independently.
  - Such notices are kept regardless of age. `endDate` is `null`, `endDateStatus` is `not_provided`, and `ageDays` is included.
  - `unknown` covers an inconsistent date pair or a query time on a date-only boundary.
  - Expired notices are excluded and counted.
- **Spatial check:**
  - Published geometry is checked for every active notice, from every USACE district.
  - Geometry-less notices from districts within 25 nm of the corridor are listed in `unverifiedLocationNotices`; others are counted only.
  - A notice whose geometry can't be retrieved makes coverage `partial`.
- **Status:**
  - `success`: every source was checked.
  - `partial`: a source, or some notice geometry, was not checked; or nothing was confirmed on the route while nearby notices have no published geometry.
  - `source_unavailable`: no core source answered.
  - `invalid_input`: the route was rejected.
- **Lock freshness:** LPMS states no timezone. `current` means the report is at most 6 h old assuming UTC-4..UTC-8; otherwise it is `possibly_stale` or `stale`.

### Pricing (pay per event)

- `apify-actor-start`: $0.00005.
- `waterway-route-check`: $0.10, charged when:
  - the run succeeded (including zero matches with no nearby geometry-less notices), or
  - the result is partial, both core sources (the NTNI list and the Locks layer) were checked, and something matched.
- Never charged for invalid input, unavailable sources, or partial zero-match results (including zero confirmed matches with nearby geometry-less notices).

### Input

```json
{"route": [{"lat": 40.4425, "lon": -80.015}, {"lat": 40.5263, "lon": -80.6275}], "corridorNm": 1, "atTime": "2026-10-13T15:00:00Z"}
```

# Actor input Schema

## `route` (type: `array`):

Inland-waterway route you supply, as an ordered list of {"lat", "lon"} points (WGS84). The Actor does not plan routes; follow the channel closely enough for the corridor to cover it.

## `corridorNm` (type: `number`):

Distance either side of the route within which notices and locks are matched. Default 1.

## `atTime` (type: `string`):

ISO 8601 time with timezone used for notice temporal status, e.g. 2026-10-12T15:00:00Z. Defaults to now. Lock operating conditions always reflect retrieval time.

## Actor input object example

```json
{
  "route": [
    {
      "lat": 40.4425,
      "lon": -80.015
    },
    {
      "lat": 40.5106,
      "lon": -80.082
    },
    {
      "lat": 40.6463,
      "lon": -80.412
    },
    {
      "lat": 40.5263,
      "lon": -80.6275
    },
    {
      "lat": 40.165,
      "lon": -80.699
    }
  ],
  "corridorNm": 1
}
```

# Actor output Schema

## `result` (type: `string`):

The single record: status, coverage (ntni, ntniGeometry, corpsLocks, lpms, completeForRequestedSources, sourceFailures, coverageNote), summary, constraints, locks, notices, unverifiedLocationNotices and billing.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "route": [
        {
            "lat": 40.4425,
            "lon": -80.015
        },
        {
            "lat": 40.5106,
            "lon": -80.082
        },
        {
            "lat": 40.6463,
            "lon": -80.412
        },
        {
            "lat": 40.5263,
            "lon": -80.6275
        },
        {
            "lat": 40.165,
            "lon": -80.699
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("rhincodontypus/usace-waterway-transit-constraint-resolver").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "route": [
        {
            "lat": 40.4425,
            "lon": -80.015,
        },
        {
            "lat": 40.5106,
            "lon": -80.082,
        },
        {
            "lat": 40.6463,
            "lon": -80.412,
        },
        {
            "lat": 40.5263,
            "lon": -80.6275,
        },
        {
            "lat": 40.165,
            "lon": -80.699,
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("rhincodontypus/usace-waterway-transit-constraint-resolver").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "route": [
    {
      "lat": 40.4425,
      "lon": -80.015
    },
    {
      "lat": 40.5106,
      "lon": -80.082
    },
    {
      "lat": 40.6463,
      "lon": -80.412
    },
    {
      "lat": 40.5263,
      "lon": -80.6275
    },
    {
      "lat": 40.165,
      "lon": -80.699
    }
  ]
}' |
apify call rhincodontypus/usace-waterway-transit-constraint-resolver --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,rhincodontypus/usace-waterway-transit-constraint-resolver"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/yCe6FapeAhjNo6XiQ/builds/OUEzG3friZOS6DrAC/openapi.json
