Write a project input layer from GeoJSON
write_input_layerWrite a project input layer (boundary, friction, inflow, rainfall, building, mesh_region or culvert) from GeoJSON you send in this call.
Instructions
Write a project input layer (boundary, friction, inflow, rainfall, building, mesh_region or culvert) from GeoJSON you send in this call.
ASK FIRST: before you write any input, ask the person which approach they want (rain-on-grid, or an inflow hydrograph at a place they name), whether by 'hydrograph' they mean an inflow that drives the model or the flow they want out of the results, and for their design rainfall and losses; do not choose or source these yourself unless they ask you to.
No file, no key, no upload: the features go in features. Hydrata
converts them into the project's grid and puts them in the project's
default layer of that kind. Unlike attach_input_layer there is nothing to
poll.
VARIANTS: the default row may feed scenarios that already ran, and writing
it changes what they point at. For a variant (a copy of a scenario with
different rainfall, say) write a SEPARATE row with target set to a
title, then attach it to the copy with update_scenario or clone_scenario.
A no-target write to a default row that a scenario with a built or
complete run uses is refused, naming those scenarios, unless the person
agreed and you pass replace_shared=true.
READ FIRST with read_input_layer. When the layer holds features a person drew, this tool ADDS yours beside them (mode 'append', the default; their feature ids hold). A replace (mode 'replace') writes a new layer and unlinks the old one, so it is refused unless the person agreed and you pass replace_existing=true; the refusal says how many of their features it would remove. Ask them before you replace.
Every feature must be the kind's geometry (lines for boundary, inflow and culvert; polygons for friction, rainfall, building and mesh_region); a feature of another geometry refuses the whole write and nothing changes. A culvert is one two-point line per culvert, Inlet first, then Outlet; its attributes are the culvert fields (name, shape, width_m, ... see the culvert guidance), nothing is renamed for you.
Limit: about 150 KB of GeoJSON (a few thousand vertices). A bigger layer is refused before anything is sent: ask the person to upload it in their browser with a request_input_upload link instead.
The layer is marked as written by your agent key and is UNREVIEWED until the user reviews it in their browser. INFLOWS: never invent an inflow location; take it from the study's files or give the user the ui_url to draw it.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"project_id": "<project_id>",
"kind": "<kind>",
"features": "<features>"
},
"name": "write_input_layer"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | Which input this is: boundary, friction, inflow, rainfall, building, mesh_region or culvert ('structure' is a deprecated alias of building). | |
| mode | No | 'append' adds `features` to the layer's existing features (the person's keep their ids); 'replace' writes a new layer. Leave empty: Hydrata appends when the layer holds features a person drew, and replaces otherwise. | |
| method | No | One short phrase saying how you made these features (e.g. 'traced from the council PDF', 'digitised from the survey CSV'). Shown to the person who reviews the layer. | |
| target | No | Which input row to write: an existing row id of this kind (list_inputs), or a TITLE for a NEW row of this kind (e.g. 'Rainfall - no losses'). Leave empty to write the project's default row. A new row is attached to no scenario until you attach it with update_scenario. | |
| sources | No | The documents this came from, so the engineer can click through to them: a list of {title, url, locator}, e.g. [{title: 'GHD 2015 Sullivans Creek Flood Study', url: 'https://...', locator: 'Table 5-2'}]. Limits: title (1-200 characters) and url (http or https, at most 2000 characters) are required; locator (a page or table, e.g. 'p. 42' or 'Table 5-2') is optional, at most 100 characters. At most 20 entries. Pass it beside the method whenever you cite a document. | |
| features | Yes | A GeoJSON FeatureCollection with every feature of this kind. Coordinates are read as EPSG:4326 (lon/lat) unless the collection declares a `crs` member; Hydrata converts them into the project's grid. Multi* geometries are split into single ones. | |
| project_id | Yes | The project ID | |
| replace_shared | No | Only true after the person agreed to change a default row that scenarios with a built or complete run use. Without it that write is refused and the refusal names those scenarios. | |
| replace_existing | No | Only true after the person agreed to a replace that removes the features they drew. Without it a replace of a layer holding their features is refused and the refusal says how many. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||