Class: QgsNetworkStrategy¶
Defines strategy used for calculation of the edge cost in networks.
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.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: cost()
Class Hierarchy¶
Subclasses¶
Strategy for calculating edge cost based on its length. |
|
Strategy for calculating edge cost based on travel time. |
Abstract Methods
Returns edge cost |
Virtual Methods
In PyQGIS, only methods marked as virtual
can be safely overridden in a Python subclass of QgsNetworkStrategy. See the FAQ for more details.
Returns a list of the source layer attributes needed for cost calculation. |
- class qgis.analysis.QgsNetworkStrategy[source]¶
Bases:
object
- abstract cost(self, distance: float, f: QgsFeature) Any [source]¶
Returns edge cost
- Parameters:
distance (float)
f (QgsFeature)
- Return type:
Any
- virtual requiredAttributes(self) Any ¶
Returns a list of the source layer attributes needed for cost calculation. This is method called by
QgsGraphDirector
.- Return type:
Any