Attach an uploaded layer as a project input
attach_input_layerAttaches an uploaded GeoJSON to a Hydrata project as its boundary, friction, inflow, rainfall, building, mesh_region, or culvert input layer.
Instructions
Attach a GeoJSON you uploaded to GeoNode as the project's boundary, friction, inflow, rainfall, building, mesh_region or culvert layer.
Only for a client that has a shell and an agent key. A connector agent with no shell (claude.ai) writes the layer inline with write_input_layer, or, for a file above the inline cap, gives the user the request_input_upload link instead.
The agent moves the bytes: first upload the GeoJSON yourself, with the same agent key, to GeoNode's upload endpoint at the site origin:
curl -sS -H 'Authorization: Bearer hk_...' -F "base_file=@/path/rainfall.geojson" https://<site>/api/v2/uploads/upload/→ JSON with execution_id. Then call this tool with it. The tool polls
GET /api/v2/resource-service/execution-status/<execution_id> (bounded by
timeout_seconds; statuses ready → running → finished | failed), reads the
new dataset's pk, and PATCHes it onto the project's DEFAULT row of that
kind ('Boundary 01' … 'MeshRegion 01' — the six rows the terrain import
seeds ~30 s after get_terrain reports ready; if the list is still empty
the tool says so: run finalize_terrain_upload / wait for get_terrain first).
kind culvert (Hydraulic Structures; one two-point line per culvert,
Inlet first, then Outlet): no culvert row is seeded by the terrain import,
so a project with none answers no_default_row: write the culverts with
write_input_layer, which makes the row. Hydrata converts every attached
layer into the project's grid and the kind's table shape (single
geometries, the_geom, the kind's own columns); attribute names are matched
as they are, nothing is renamed for you (see write_input_layer).
The culvert engine conveys flow through each culvert in a run (GPU
lanes and localhost; the multi-core CPU lanes refuse a culvert scenario).
outcome is exactly one of: attached (row_id, gn_layer, dataset_pk and
dataset_alternate — the WFS typename — of the CONVERTED layer the row now
uses, source_dataset_pk — the dataset you uploaded — and every row id seen);
timed_out (still importing: call
again with the same arguments, except pass retry_execution_id as
execution_id when the result carries one); upload_failed (the
execution record, incl. its log, is returned verbatim — fix the file and
upload again); no_default_row; no_dataset (finished but no resource
was recorded). The PATCH is refused with a 400 if the dataset is not
owned by you.
Every layer attached here is marked as written by your agent key and is UNREVIEWED until the user reviews it in their browser (the build refuses UNREVIEWED_INPUTS until then). INFLOWS: never invent an inflow location — no coordinates you made up, guessed or "placed plausibly". Import the location from the study's own files, or give the user the ui_url to draw it in the map; say in say_to_user that the inflow is unreviewed and where they check or draw it.
Refused, with no request made: kind breakline — no REST create path
exists for it at HEAD (TASK-3040 AC6), so attaching one would only
pretend. Also refused without a request: an execution_id that is not the
UUID the upload returned.
One GeoJSON per kind: all of a kind's features travel in that one file. A
rainfall polygon names its gauge in its data property — create that
gauge with create_time_series under the exact same name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | Which input the uploaded layer is: boundary, friction, inflow, rainfall, building, mesh_region or culvert ('structure' is a deprecated alias of building). breakline is refused (see below). | |
| project_id | Yes | The project ID | |
| execution_id | Yes | `execution_id` returned by your multipart POST to <origin>/api/v2/uploads/upload/ | |
| timeout_seconds | No | How long this call keeps polling the upload before it returns `timed_out` (default 180, ceiling 200 — claude.ai cuts a tool call at 240 s). 0 = one status read, no waiting. | |
| poll_interval_seconds | No | Seconds between polls (default 5) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||