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
getAsset(asset_id: str): Optional[Asset]
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[]
getAssets(predicate: Optional[Callable[[Asset], bool]] = None) -> list[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')
zone = sdk.network.get_zone('Nelly Bay DMA')pipes = zone.getAssets(lambda 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[]
getBoundaryValves() -> list[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[]
getJunctions(predicate: Optional[Callable[[Junction], bool]] = None) -> list[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)
zone = sdk.network.get_zone('Nelly Bay DMA')junctions = zone.getJunctions(lambda 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[]
getPipes(predicate: Optional[Callable[[Pipe], bool]] = None) -> list[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)
zone = sdk.network.get_zone('Nelly Bay DMA')pipes = zone.getPipes(lambda 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[]
getPumps(predicate: Optional[Callable[[Pump], bool]] = None) -> list[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)
zone = sdk.network.getZone('Nelly Bay DMA')pumps = zone.getPumps(lambda 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[]
getSupplySources(predicate: Optional[Callable[[SupplySource], bool]] = None) -> list[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)
zone = sdk.network.get_zone('Nelly Bay DMA')supplySources = zone.getSupplySources(lambda 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[]
getTanks(predicate: Optional[Callable[[Tank], bool]] = None) -> list[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)
zone = sdk.network.get_zone('Nelly Bay DMA')tanks = zone.getTanks(lambda 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[]
getValves(predicate: Optional[Callable[[Valve], bool]] = None) -> list[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)
zone = sdk.network.get_zone('Nelly Bay DMA')closedValves = zone.getValves(lambda valve: valve.status == ValveStatus.CLOSED)