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 MultiPolygon object.
inlets
Section titled “inlets”An array representing the inlets of the zone. Objects in the array are of type Pipe.
outlets
Section titled “outlets”An array representing the outlets of the zone. Objects in the array are of type Pipe.
Asset Queries
Section titled “Asset Queries”getAsset()
Section titled “getAsset()”Returns the zone asset with the specified id, as an Asset object.
Method signature
Section titled “Method signature”getAsset(assetId: string) : Asset | undefined
getAssets()
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?: function) : 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')
For your convenience, the following methods return an array of specific types of assets:
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[]
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?: function) : 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)
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?: function) : 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)
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?: function) : 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?: function) : 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)
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?: function) : Tank[]
Example
Section titled “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()
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?: function) : 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)