geoVeRoPy.travel module

geoVeRoPy.travel.matrixDist(nodes: dict, locFieldName: str = 'loc', nodeIDs: list | str = 'All', edges: str = 'Euclidean', detailFlag: bool = False, **kwargs) dict[source]

Given a nodes dictionary, returns the traveling matrix between nodes

Parameters:
  • nodes (dict, required) – A `nodes`dictionary with location information

  • locFieldName (str, optional, default as 'loc') – The key in nodes dictionary to indicate the locations

  • nodeIDs (list of int|str, or 'All', optional, default as 'All') – A list of nodes in nodes that needs to be considered, other nodes will be ignored

  • edges (str, optional, default as 'Euclidean') –

    The methods for the calculation of distances between nodes. Options and required additional information are as follows:

    1. (default) ‘Euclidean’, using Euclidean distance, no additional information needed

    2. ’EuclideanBarrier’, using Euclidean distance, if polys is provided, the path between nodes will consider them as barriers and by pass those areas.
      • polys: list of poly, the polygons to be considered as barriers

    3. ’LatLon’, calculate distances by lat/lon, no additional information needed
      • distUnit: str, the unit of distance, default as ‘meter’

    4. ’ManhattenXY’, calculate distance by Manhatten distance

    5. ’Dictionary’, directly provide the travel matrix
      • tau: the traveling matrix

    6. ’Grid’, traveling on a grid with barriers, usually used in warehouses
      • column: number of columns

      • row: number of rows

      • barrier: a list of coordinates on the grid indicating no-entrance

  • **kwargs (optional) – Provide additional inputs for different edges options

Returns:

Two dictionaries, the first one is the travel matrix, index by (nodeID1, nodeID2), the second one is the dictionary for path between start and end locations (useful for ‘EuclideanBarrier’).

Return type:

tuple

geoVeRoPy.travel.scaleDist(loc1: list[float] | tuple[float, float], loc2: list[float] | tuple[float, float], edges: str = 'Euclidean', **kwargs) dict[source]

Given a two locations, returns the traveling distance and path between locations.

Parameters:
  • loc1 (pt, required) – The first location.

  • loc2 (pt, required) – The second location.

  • edges (str, optional, default as 'Euclidean') – The methods for the calculation of distances between nodes. Options and required additional information are referred to matrixDist().

  • **kwargs (optional) – Provide additional inputs for different edges options

Returns:

tau, revTau, pathLoc, revPathLoc. Four keys, the first one is the travel distance from loc to each node index by nodeID, the second the travel distance from each node back to loc. The third and fourth dictionaries are the corresponded path.

Return type:

dict

geoVeRoPy.travel.vectorDist(loc: list[float] | tuple[float, float], nodes: dict, locFieldName: str = 'loc', nodeIDs: list | str = 'All', edges: str = 'Euclidean', **kwargs) dict[source]

Given a location and a nodes dictionary, returns the traveling distance and path between the location to each node.

Parameters:
  • loc (pt, required) – Origin/destination location.

  • nodes (dict, required) – A nodes`dictionary with location information. See :ref:`nodes for reference.

  • locFieldName (str, optional, default as 'loc') – The key in nodes dictionary to indicate the locations

  • nodeIDs (list of int|str, or 'All', optional, default as 'All') – A list of nodes in nodes that needs to be considered, other nodes will be ignored

  • edges (str, optional, default as 'Euclidean') – The methods for the calculation of distances between nodes. Options and required additional information are referred to matrixDist().

  • **kwargs (optional) – Provide additional inputs for different edges options

Returns:

tau, revTau, pathLoc, revPathLoc. Four dictionaries, the first one is the travel distance from loc to each node index by nodeID, the second the travel distance from each node back to loc. The third and fourth dictionaries are the corresponded path.

Return type:

tuple