Skip to content
We're currently creating a lot of content. Sign up to get notified when it's ready.

Zone

The Zone API lets you get information about the zones in the network. You can get a list of all the zones in the network using the getZones method of the Network object.

A string representing the zone’s unique identifier.

The geometry of the zone, as a GeoJSON Geometry object.

An array with the assets through which water enters the zone, as Asset objects.

An array with the assets through which water leaves the zone, as Asset objects.

A zone exposes the same asset queries as the Network object, restricted to the assets inside the zone. All the queries that accept a filter receive a function with the signature (asset) => boolean.

Returns the zone asset with the specified ID, as an Asset object, or undefined if the zone has no asset with that ID.

getAsset<T extends Asset = Asset>(assetId: string) : T | undefined

Returns an array with all the assets in the zone that match the filter function, as Asset objects. If no filter is provided, all the assets in the zone are returned.

getAssets(filter?: AssetFilterFn<Asset>) : Asset[]

Get all the pipes in the “Nelly Bay DMA” zone:

const zone = qatium.network.getZone('Nelly Bay DMA')
const pipes = zone.getAssets((asset) => asset.type === 'Pipe')

Returns true if at least one asset in the zone matches the given function, or false if no match is found. If no stopFn is provided, it returns true if the zone has any asset.

someAsset(stopFn?: (asset: Asset) => boolean) : boolean
const zone = qatium.network.getZone('Nelly Bay DMA')
const hasTanks = zone.someAsset((asset) => asset.type === 'Tank')

Returns an array with all the boundary valves in the zone, as Valve objects.

getBoundaryValves() : Valve[]

For your convenience, the following methods return an array of specific types of assets:

Returns an array with all the junctions in the zone that match the filter function, as Junction objects. If no filter is provided, all the junctions in the zone are returned.

getJunctions(filter?: AssetFilterFn<Junction>) : Junction[]

Get all the junctions in the “Nelly Bay DMA” zone, with an elevation that’s lower than 1:

const zone = qatium.network.getZone('Nelly Bay DMA')
const junctions = zone.getJunctions((junction) => junction.elevation < 1)

Returns an array with all the junctions with group customerPoint in the zone that match the filter function, as Junction objects.

getCustomerPoints(filter?: AssetFilterFn<Junction>) : Junction[]

Returns an array with all the junctions with group hydrant in the zone that match the filter function, as Junction objects.

getHydrants(filter?: AssetFilterFn<Junction>) : Junction[]

Returns an array with all the pipes in the zone that match the filter function, as Pipe objects. If no filter is provided, all the pipes in the zone are returned.

getPipes(filter?: AssetFilterFn<Pipe>) : Pipe[]

Get all the pipes in the “Nelly Bay DMA” zone, with a diameter that’s greater than 20:

const zone = qatium.network.getZone('Nelly Bay DMA')
const pipes = zone.getPipes((pipe) => pipe.diameter > 20)

Returns an array with all the pipes with group main in the zone that match the filter function, as Pipe objects.

getMainPipes(filter?: AssetFilterFn<Pipe>) : Pipe[]

Returns an array with all the pipes with group lateral in the zone that match the filter function, as Pipe objects.

getLateralPipes(filter?: AssetFilterFn<Pipe>) : Pipe[]

Returns an array with all the pipes with level arterial in the zone that match the filter function, as Pipe objects.

getArterialPipes(filter?: AssetFilterFn<Pipe>) : Pipe[]

Returns an array with all the pipes with level distribution in the zone that match the filter function, as Pipe objects.

getDistributionPipes(filter?: AssetFilterFn<Pipe>) : Pipe[]

Returns an array with all the pumps in the zone that match the filter function, as Pump objects. If no filter is provided, all the pumps in the zone are returned.

getPumps(filter?: AssetFilterFn<Pump>) : Pump[]

Get all the pumps in the “Nelly Bay DMA” zone, with a relative speed setting equal to 1:

const zone = qatium.network.getZone('Nelly Bay DMA')
const pumps = zone.getPumps((pump) => pump.setting === 1)

Returns an array with all the supply sources in the zone that match the filter function, as SupplySource objects. If no filter is provided, all the supply sources in the zone are returned.

getSupplySources(filter?: AssetFilterFn<SupplySource>) : SupplySource[]

Get all the supply sources in the “Nelly Bay DMA” zone, with a head greater than zero:

const zone = qatium.network.getZone('Nelly Bay DMA')
const supplySources = zone.getSupplySources((source) => (source.head ?? 0) > 0)

Returns an array with all the tanks in the zone that match the filter function, as Tank objects. If no filter is provided, all the tanks in the zone are returned.

getTanks(filter?: AssetFilterFn<Tank>) : Tank[]

Get all the tanks in the “Nelly Bay DMA” zone, with a simulated water level greater than 1:

const zone = qatium.network.getZone('Nelly Bay DMA')
const tanks = zone.getTanks((tank) => (tank.simulation?.level ?? 0) > 1)

Returns an array with all the valves in the zone that match the filter function, as Valve objects. If no filter is provided, all the valves in the zone are returned.

getValves(filter?: AssetFilterFn<Valve>) : Valve[]

Get all the closed valves in the “Nelly Bay DMA” zone:

const zone = qatium.network.getZone('Nelly Bay DMA')
const closedValves = zone.getValves((valve) => valve.status === ValveStatus.CLOSED)

Returns an array with all the valves with group regulating in the zone that match the filter function, as Valve objects.

getRegulatingValves(filter?: AssetFilterFn<Valve>) : Valve[]

Returns an array with all the valves with group shutOff in the zone that match the filter function, as Valve objects.

getShutOffValves(filter?: AssetFilterFn<Valve>) : Valve[]