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.
Properties
Section titled “Properties”A string representing the zone’s unique identifier.
geometry
Section titled “geometry”The geometry of the zone, as a GeoJSON Geometry object.
inlets
Section titled “inlets”An array with the assets through which water enters the zone, as Asset objects.
outlets
Section titled “outlets”An array with the assets through which water leaves the zone, as Asset objects.
Asset Queries
Section titled “Asset Queries”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.
getAsset()
Section titled “getAsset()”Returns the zone asset with the specified ID, as an Asset object, or undefined if the zone has no asset with that ID.
Method signature
Section titled “Method signature”getAsset<T extends Asset = Asset>(assetId: string) : T | undefinedgetAssets()
Section titled “getAssets()”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.
Method signature
Section titled “Method signature”getAssets(filter?: AssetFilterFn<Asset>) : Asset[]Example
Section titled “Example”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')someAsset()
Section titled “someAsset()”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.
Method signature
Section titled “Method signature”someAsset(stopFn?: (asset: Asset) => boolean) : booleanExample
Section titled “Example”const zone = qatium.network.getZone('Nelly Bay DMA')const hasTanks = zone.someAsset((asset) => asset.type === 'Tank')getBoundaryValves()
Section titled “getBoundaryValves()”Returns an array with all the boundary valves in the zone, as Valve objects.
Method signature
Section titled “Method signature”getBoundaryValves() : Valve[]For your convenience, the following methods return an array of specific types of assets:
getJunctions()
Section titled “getJunctions()”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.
Method signature
Section titled “Method signature”getJunctions(filter?: AssetFilterFn<Junction>) : Junction[]Example
Section titled “Example”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)getCustomerPoints()
Section titled “getCustomerPoints()”Returns an array with all the junctions with group customerPoint in the zone that match the filter function, as Junction objects.
Method signature
Section titled “Method signature”getCustomerPoints(filter?: AssetFilterFn<Junction>) : Junction[]getHydrants()
Section titled “getHydrants()”Returns an array with all the junctions with group hydrant in the zone that match the filter function, as Junction objects.
Method signature
Section titled “Method signature”getHydrants(filter?: AssetFilterFn<Junction>) : Junction[]getPipes()
Section titled “getPipes()”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.
Method signature
Section titled “Method signature”getPipes(filter?: AssetFilterFn<Pipe>) : Pipe[]Example
Section titled “Example”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)getMainPipes()
Section titled “getMainPipes()”Returns an array with all the pipes with group main in the zone that match the filter function, as Pipe objects.
Method signature
Section titled “Method signature”getMainPipes(filter?: AssetFilterFn<Pipe>) : Pipe[]getLateralPipes()
Section titled “getLateralPipes()”Returns an array with all the pipes with group lateral in the zone that match the filter function, as Pipe objects.
Method signature
Section titled “Method signature”getLateralPipes(filter?: AssetFilterFn<Pipe>) : Pipe[]getArterialPipes()
Section titled “getArterialPipes()”Returns an array with all the pipes with level arterial in the zone that match the filter function, as Pipe objects.
Method signature
Section titled “Method signature”getArterialPipes(filter?: AssetFilterFn<Pipe>) : Pipe[]getDistributionPipes()
Section titled “getDistributionPipes()”Returns an array with all the pipes with level distribution in the zone that match the filter function, as Pipe objects.
Method signature
Section titled “Method signature”getDistributionPipes(filter?: AssetFilterFn<Pipe>) : Pipe[]getPumps()
Section titled “getPumps()”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.
Method signature
Section titled “Method signature”getPumps(filter?: AssetFilterFn<Pump>) : Pump[]Example
Section titled “Example”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)getSupplySources()
Section titled “getSupplySources()”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.
Method signature
Section titled “Method signature”getSupplySources(filter?: AssetFilterFn<SupplySource>) : SupplySource[]Example
Section titled “Example”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)getTanks()
Section titled “getTanks()”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.
Method signature
Section titled “Method signature”getTanks(filter?: AssetFilterFn<Tank>) : Tank[]Example
Section titled “Example”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)getValves()
Section titled “getValves()”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.
Method signature
Section titled “Method signature”getValves(filter?: AssetFilterFn<Valve>) : Valve[]Example
Section titled “Example”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)getRegulatingValves()
Section titled “getRegulatingValves()”Returns an array with all the valves with group regulating in the zone that match the filter function, as Valve objects.
Method signature
Section titled “Method signature”getRegulatingValves(filter?: AssetFilterFn<Valve>) : Valve[]getShutOffValves()
Section titled “getShutOffValves()”Returns an array with all the valves with group shutOff in the zone that match the filter function, as Valve objects.
Method signature
Section titled “Method signature”getShutOffValves(filter?: AssetFilterFn<Valve>) : Valve[]