Class: QgsNetworkStrategy

QgsNetworkStrategy defines strategy used for calculation of the edge cost. For example it can take into account travel distance, amount of time or money. Currently there are two strategies implemented in the analysis library: QgsNetworkDistanceStrategy and QgsNetworkSpeedStrategy. QgsNetworkStrategy implemented using “strategy” design pattern.

Class Hierarchy

Inheritance diagram of qgis.analysis.QgsNetworkStrategy

Subclasses

QgsNetworkDistanceStrategy

Strategy for calculating edge cost based on its length. Should be used for finding shortest path between two points.

QgsNetworkSpeedStrategy

Strategy for calculating edge cost based on travel time. Should be used for finding fastest path between two points.

Methods

cost

Returns edge cost

requiredAttributes

Returns a list of the source layer attributes needed for cost calculation.

class qgis.analysis.QgsNetworkStrategy[source]

Bases: object

cost(self, distance: float, f: QgsFeature) Any[source]

Returns edge cost

Parameters:
Return type:

Any

requiredAttributes(self) Any

Returns a list of the source layer attributes needed for cost calculation. This is method called by QgsGraphDirector.

Return type:

Any