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
id
A string representing the zone’s unique identifier.
geometry
The geometry of the zone, as a GeoJSON MultiPolygon object.
inlets
An array representing the inlets of the zone. Objects in the array are of type Pipe.
outlets
An array representing the outlets of the zone. Objects in the array are of type Pipe.
Asset Queries
getAsset()
Returns the zone asset with the specified id, as an Asset object.
Method signature
getAsset(assetId: string) : Asset | undefined
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
getAssets(filter?: function) : Asset[]
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')
For your convenience, the following methods return an array of specific types of assets:
getBoundaryValves()
Returns an array with all the boundary valves in the zone, as Valve objects.
Method signature
getBoundaryValves: () => Valve[]
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
getJunctions(filter?: function) : Junction[]
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)
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
getPipes(filter?: function) : Pipe[]
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)
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
getPumps(filter?: function) : Pump[]
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()
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
getSupplySources(filter?: function) : SupplySource[]
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)
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
getTanks(filter?: function) : Tank[]
Example
Get all the tanks in the “Nelly Bay DMA” zone, with a level that’s greater than 1:
const zone = qatium.network.getZone('Nelly Bay DMA')const tanks = zone.getTanks((tank) => tank.level > 1)
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
getValves(filter?: function) : Valve[]
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)