Grow Territory from Seed
seed_buildGrows one territory outward from a seed {longitude, latitude} over a part layer until it holds a target: {type: location_count, value: N} or {type: metric_sum, field: , value: X}, counted from an ingested point layer. Adds the territory as a leaf of tal_id, or as a new alignment. Fit is closest: target_status is reached, closest_under, closest_over, frontier_exhausted, or max_parts_reached, with SEED_TARGET_UNDERSHOT/OVERSHOT warnings and the difference. Parts already in that alignment are never taken; the territory grows around them (blocked_part_count, seed_offset_km), and a seed inside an assigned part returns SEED_PART_ASSIGNED. part_scope=explicit with part_filter confines growth to an area (not_in_tal: {tal_id} keeps it out of another TAL; in_tal: {tal_id} keeps it inside one, with no tal_id so it starts a new alignment). One seed per call. An undeclared metric field returns UNDECLARED_FIELD. Returns a task with created_territory and ts_handle; the open map repaints with map_session_id.
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": {
"seed": "<seed>",
"target": "<target>"
},
"name": "seed_build"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| seed | Yes | Where growth starts. For an address or POI, stage it as one row with request_account_upload, then geocode_address(upload_handle); a map click already gives coordinates. | |
| tal_id | No | Existing TAL to append the new leaf to. Parts already assigned to any leaf of this TAL are never taken (the territory drifts instead). Without it, a new TAL is created. | |
| target | Yes | What the territory grows toward. Fit is closest: |achieved - value| is minimized, so the result may land slightly under or over. | |
| user_id | No | Stable per-user label for usage and queue ordering. | |
| part_ids | No | Explicit eligible part set. Implies part_scope explicit. Mutually exclusive with part_filter. | |
| max_parts | No | Safety cap on parts in the grown territory. Reaching it stops growth with target_status max_parts_reached. | |
| tal_label | No | Display name for the new TAL when tal_id is omitted. Ignored when tal_id is given. | |
| ts_handle | No | Territory Solution reference (tsh_...) from a build, ingest_accounts, import_geojson, import_designer_project, or get_map_visualization; Territory Solutions are not accepted inline. | |
| part_layer | No | Part layer to grow over, e.g. us_zips (ezt://part-layers). Required unless tal_id names a TAL that already has one; must match that TAL's layer when both are given. | |
| part_scope | No | Growth reads only the seed's neighbourhood (rings outward from the seed part), so this is an allowlist switch, not a performance prerequisite. explicit: confine growth to part_ids or part_filter (e.g. state_abbr TX) when the user wants the territory bounded by that geography. bbox_intersect / point_matched are accepted for compatibility with auto_build and ignored — seed_build never joins the whole point layer to the bbox parts. | |
| part_filter | No | Attribute filter resolved via query_parts (e.g. {"state_abbr": "TX"}). Implies part_scope explicit. Mutually exclusive with part_ids. Inside an existing TAL's footprint: {"in_tal": {"tal_id": "tal-1"}} with no seed tal_id (in_tal of the seed's own tal_id is INVALID_REQUEST). White space (parts no TAL covers): add not_in_tal, e.g. {"state_abbr": "TX", "not_in_tal": {"tal_id": "tal-1"}}; a person-trimmed set is {"selection_task_id": "psel_..."} after get_part_selection reports committed. | |
| point_layer | No | Ingested point layer whose locations are counted or summed. Required when the TS has more than one point layer. | |
| map_session_id | No | Open map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set. | |
| territory_name | No | Display name for the new leaf. Defaults to the next free "Territory N" in the TAL. Must be unique within the TAL. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| error | No | Present when ok is false. | |
| result | No | Present when ok is true. | |
| warnings | No |