veroviz.createAssignments module¶
-
addAssignment2D
(initAssignments=None, odID=1, objectID=None, modelFile=None, startLoc=None, endLoc=None, startTimeSec=0.0, expDurationSec=None, routeType='euclidean2D', speedMPS=None, leafletColor='orange', leafletWeight=3, leafletStyle='solid', leafletOpacity=0.8, leafletCurveType='straight', leafletCurvature=0, useArrows=True, modelScale=100, modelMinPxSize=75, cesiumColor='orange', cesiumWeight=3, cesiumStyle='solid', cesiumOpacity=0.8, ganttColor='darkgray', popupText=None, dataProvider=None, dataProviderArgs=None)[source]¶ This function appends to an existing Assignments dataframe, or creates a new Assignments dataframe if initAssignments is None. The new rows in this dataframe describe all of the “shapepoints” between given starting and ending locations, including timestamps indicating the departure and arrival times for each shapepoint. Shapepoints are pairs of GPS coordinates that are connected by straight lines. For a given origin and destination, numerous individual shapepoints can be combined to define a travel route along a road network.
Note
This function is for vehicles traveling on a ground plane (2-dimensional). For vehicles requiring an altitude component (e.g., drones), a 3D version of this function is provided by addAssignment3D().
- Parameters
initAssignments (Assignments dataframe, Optional, default as None) – If provided, the function will append this dataframe.
odID (int, Optional, default as 1) – This field allows grouping of dataframe rows according to common origin/destination pairs. Arc segments which are part of the same origin/destination share the same odID.
objectID (int/string, Optional, default as None) – A descriptive name or index for a particular vehicle or object (e.g., ‘truck 1’, or ‘red car’).
modelFile (string, Optional, default as None) – The relative path and filename of the 3D model associated with this object. The 3D model, typically in the format of .gltf or .glb, will be visualized in Cesium. The path should be relative to the directory where Cesium is installed (i.e., the modelFile should exist within the Cesium root directory).
startLoc (list, Required, default as None) – The starting location, expressed as either [lat, lon, alt] or [lat, lon]. If no altitude is provided, it will be assumed to be 0 meters above ground level.
endLoc (list, Required, default as None) – The ending location, expressed as either [lat, lon, alt] or [lat, lon]. If no altitude is provided, it will be assumed to be 0 meters above ground level.
startTimeSec (float, Optional, default as 0.0) – The time, in seconds, at which the vehicle may leave the starting location.
expDurationSec (float, Optional, default as None) – This is the number of seconds we expect to travel from the start to the end location. This value typically comes from the traval time matrix (see the getTimeDist functions). Including an expected duration will help keep these two values in alignment. If necessary, travel times for the individual shapepoints will be redistributed.
routeType (string, Optional, default as 'euclidean2D') – This describes a characteristic of the travel mode. Possible values are: ‘euclidean2D’, ‘manhattan’, ‘fastest’, ‘shortest’, ‘pedestrian’, ‘cycling’, and ‘truck’. The ‘euclidean2D’ and ‘manhattan’ options are calculated directly from GPS coordinates, without a road network. Neither of these two options require a data provider. However, the other options rely on road network information and require a data provider. Furthermore, some of those other options are not supported by all data providers. See Data Providers for details.
speedMPS (float, Conditional, default as None) – Speed of the vehicle, in units of meters per second. For route types that are not road-network based (i.e., ‘euclidean2D’ and ‘manhattan’), this field is required to calculate travel times. Otherwise, if a route type already incorporates travel speeds from road network data, (i.e., ‘fastest’, ‘shortest’, and ‘pedestrain’), this input argument may be ignored. If provided, speedMPS will override travel speed data used by the route type option.
leafletColor (string, Optional, default as "orange") – The color of the route when displayed in Leaflet. See Leaflet Style for a list of available colors.
leafletWeight (int, Optional, default as 3) – The pixel width of the route when displayed in Leaflet.
leafletStyle (string, Optional, default as 'solid') – The line style of the route when displayed in Leaflet. Valid options are ‘solid’, ‘dotted’, and ‘dashed’. See Leaflet Style for more information.
leafletOpacity (float in [0, 1], Optional, default as 0.8) – The opacity of the route when displayed in Leaflet. Valid values are in the range from 0 (invisible) to 1 (no transparency).
leafletCurveType (string, Optional, default as 'straight') – The type of curve to be shown on leaflet map for :ref:Arc dataframes (curves will not be applied to :ref:Assignments dataframes). The options are ‘Bezier’, ‘greatcircle’, and ‘straight’. If Bezier is provided, the leafletCurvature is also required. If greatcircle is provided, the arc follow the curvature of the Earth.
leafletCurvature (float in (-90, 90), Conditional, default as 45) – If leafletCurveType is ‘Bezier’, then leafletCurvature is required; otherwise this argument will not be used. The curvature specifies the angle between a straight line connecting the two nodes and the curved arc emanating from those two nodes. Therefore, this value should be in the open interval (-90, 90), although values in the (-45, 45) range tend to work best.
useArrows (bool, Optional, default as True) – Indicates whether arrows should be shown on the route when displayed in Leaflet.
modelScale (int, Optional, default as 100) – The scale of the 3D model (specified by the modelFile argument) when displayed in Cesium, such that 100 represents 100%.
modelMinPxSize (int, Optional, default as 75) – The minimum pixel size of the 3D model (specified by the modelFile argument) when displayed in Cesium. When zooming out, the model will not be smaller than this size; zooming in can result in a larger model.
cesiumColor (string, Optional, default as "orange") – The color of the route when displayed in Cesium. See Cesium Style for a list of available colors.
cesiumWeight (int, Optional, default as 3) – The pixel width of the route when displayed in Cesium.
cesiumStyle (string, Optional, default as 'solid') – The line style of the route when displayed in Cesium. Valid options are ‘solid’, ‘dotted’, and ‘dashed’. See Cesium Style for more information.
cesiumOpacity (float in [0, 1], Optional, default as 0.8) – The opacity of the route when displayed in Cesium. Valid values are in the range from 0 (invisible) to 1 (no transparency).
ganttColor (string, Optional, default as "darkgray") – The color of the route elements when displayed in a Gantt chart.
popupText (string, Optional, default as None) – Text (or HTML) that will be displayed when a user clicks on the arc in either Leaflet or Cesium.
dataProvider (string, Conditional, default as None) – Specifies the data source to be used for obtaining the shapepoints. See Data Providers for options and requirements.
dataProviderArgs (dictionary, Conditional, default as None) – For some data providers, additional parameters are required (e.g., API keys or database names). See Data Providers for the additional arguments required for each supported data provider.
- Returns
Assignments dataframe – An Assignments dataframe containing an ordered sequence of paired GPS coordinates describing the collection of straight-line segments required to travel from a start location to an end location.
endTimeSec (float) – The time, in seconds, at which the end location is reached.
Examples
- Import veroviz and check if it’s the latest version:
>>> import veroviz as vrv >>> vrv.checkVersion()
- Define 5 node locations, as [lat, lon] pairs:
>>> locs = [[42.8871085, -78.8731949], ... [42.8888311, -78.8649649], ... [42.8802158, -78.8660787], ... [42.8845705, -78.8762794], ... [42.8908031, -78.8770140]]
- Generate a nodes dataframe from these locations:
>>> myNodes = vrv.createNodesFromLocs(locs=locs) >>> myNodes
- View these nodes on a map:
>>> vrv.createLeaflet(nodes=myNodes)
- We’re going to hard-code a solution.
>>> # A car will start at node 1, visit nodes 2 and 3, and then return to node 1. >>> # A truck will follow a route from 1->5->4->1. >>> mySolution = { ... 'car': [[1,2], [2,3], [3,1]], ... 'truck': [[1,5], [5,4], [4,1]] >>> }
- Define some information about our 2 vehicles, for later use:
>>> vehicleProperties = { ... 'car': {'model': 'veroviz/models/car_red.gltf', ... 'leafletColor': 'red', ... 'cesiumColor': 'red'}, ... 'truck': {'model': 'veroviz/models/ub_truck.gltf', ... 'leafletColor': 'blue', ... 'cesiumColor': 'blue'} >>> }
- The following examples assume the use of ORS as the data provider. If you have saved your API key as an environment variable, you may use os.environ to access it:
>>> import os >>> ORS_API_KEY = os.environ['ORSKEY'] >>> # Otherwise, you may specify your key here: >>> # ORS_API_KEY = 'YOUR_ORS_KEY_GOES_HERE'
- Example 1 – The vehicles will visit the nodes in their routes, without any service times. Assume Euclidean travel (ignoring the road network).
>>> # Build the assignments dataframe for the 2 vehicle routes. >>> # No service times, Euclidean travel: >>> myAssignments = vrv.initDataframe('assignments') >>> for v in mySolution: ... endTimeSec = 0.0 ... for arc in mySolution[v]: ... [myAssignments, endTimeSec] = vrv.addAssignment2D( ... initAssignments = myAssignments, ... objectID = v, ... modelFile = vehicleProperties[v]['model'], ... startLoc = list(myNodes[myNodes['id'] == arc[0]][['lat', 'lon']].values[0]), ... endLoc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... routeType = 'euclidean2D', ... speedMPS = vrv.convertSpeed(25, 'miles', 'hour', 'meters', 'second'), ... leafletColor = vehicleProperties[v]['leafletColor'], ... cesiumColor = vehicleProperties[v]['cesiumColor']) >>> myAssignments
>>> # Show the routes (and nodes) on a map: >>> vrv.createLeaflet(nodes=myNodes, arcs=myAssignments)
- Example 2 – The vehicles will now travel on the road network, but we’ll still ignore service times.
>>> # No service times, Travel on road network: >>> myAssignments = vrv.initDataframe('assignments') >>> for v in mySolution: ... endTimeSec = 0.0 ... for arc in mySolution[v]: ... [myAssignments, endTimeSec] = vrv.addAssignment2D( ... initAssignments = myAssignments, ... objectID = v, ... modelFile = vehicleProperties[v]['model'], ... startLoc = list(myNodes[myNodes['id'] == arc[0]][['lat', 'lon']].values[0]), ... endLoc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... leafletColor = vehicleProperties[v]['leafletColor'], ... cesiumColor = vehicleProperties[v]['cesiumColor'], ... routeType = 'fastest', ... dataProvider = 'ORS-online', ... dataProviderArgs = {'APIkey': ORS_API_KEY}) >>> myAssignments
>>> # Show the routes (and nodes) on a map: >>> vrv.createLeaflet(nodes=myNodes, arcs=myAssignments)
- Example 3 – The vehicles are still following the road network, but now we’ll force them to match the travel times specified in a travel matrix.
>>> # We'll first create the travel time and distance matrices: >>> [timeSec, distMeters] = vrv.getTimeDist2D(nodes = myNodes, ... routeType = 'fastest', ... dataProvider = 'ORS-online', ... dataProviderArgs = {'APIkey': ORS_API_KEY})
>>> # No service times, Travel on road network, use travel times from the distance matrix: >>> # added "expDurationSec" >>> myAssignments = vrv.initDataframe('assignments') >>> for v in mySolution: ... endTimeSec = 0.0 ... for arc in mySolution[v]: ... [myAssignments, endTimeSec] = vrv.addAssignment2D( ... initAssignments = myAssignments, ... objectID = v, ... modelFile = vehicleProperties[v]['model'], ... startLoc = list(myNodes[myNodes['id'] == arc[0]][['lat', 'lon']].values[0]), ... endLoc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... expDurationSec = timeSec[arc[0], arc[1]], ... leafletColor = vehicleProperties[v]['leafletColor'], ... cesiumColor = vehicleProperties[v]['cesiumColor'], ... routeType = 'fastest', ... dataProvider = 'ORS-online', ... dataProviderArgs = {'APIkey': ORS_API_KEY}) >>> myAssignments
- Example 4 – Add service times at each destination node
>>> # 60-second service times at destinations, Travel on road network, use travel times from the distance matrix. >>> # Added use of `addStaticAssignment()` function for the service component. >>> myAssignments = vrv.initDataframe('assignments') >>> for v in mySolution: ... endTimeSec = 0.0 ... for arc in mySolution[v]: ... [myAssignments, endTimeSec] = vrv.addAssignment2D( ... initAssignments = myAssignments, ... objectID = v, ... modelFile = vehicleProperties[v]['model'], ... startLoc = list(myNodes[myNodes['id'] == arc[0]][['lat', 'lon']].values[0]), ... endLoc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... expDurationSec = timeSec[arc[0], arc[1]], ... leafletColor = vehicleProperties[v]['leafletColor'], ... cesiumColor = vehicleProperties[v]['cesiumColor'], ... routeType = 'fastest', ... dataProvider = 'ORS-online', ... dataProviderArgs = {'APIkey': ORS_API_KEY}) ... ... myAssignments = vrv.addStaticAssignment( ... initAssignments = myAssignments, ... objectID = v, ... modelFile = vehicleProperties[v]['model'], ... loc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... endTimeSec = endTimeSec + 60.0)
… endTimeSec += 60 >>> myAssignments
- Example 5 – Extend the previous example to show packages being left at destination nodes
>>> # 30-second service times at destinations, Travel on road network: >>> # added another use of `addStaticAssignment()` function to drop packages. >>> myAssignments = vrv.initDataframe('assignments') >>> for v in mySolution: ... endTimeSec = 0.0 ... for arc in mySolution[v]: ... [myAssignments, endTimeSec] = vrv.addAssignment2D( ... initAssignments = myAssignments, ... objectID = v, ... modelFile = vehicleProperties[v]['model'], ... startLoc = list(myNodes[myNodes['id'] == arc[0]][['lat', 'lon']].values[0]), ... endLoc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... leafletColor = vehicleProperties[v]['leafletColor'], ... cesiumColor = vehicleProperties[v]['cesiumColor'], ... routeType = 'fastest', ... dataProvider = 'ORS-online', ... dataProviderArgs = {'APIkey': ORS_API_KEY}) ... ... myAssignments = vrv.addStaticAssignment( ... initAssignments = myAssignments, ... objectID = v, ... modelFile = vehicleProperties[v]['model'], ... loc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... endTimeSec = endTimeSec + 30.0) ... ... endTimeSec += 30 ... ... myAssignments = vrv.addStaticAssignment( ... initAssignments = myAssignments, ... objectID = 'package %s %d' % (v, arc[1]), ... modelFile = '/veroviz/models/box_yellow.gltf', ... loc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... endTimeSec = -1) >>> myAssignments
- If you have saved your Cesium path as an environment variable, you may use os.environ to access it:
>>> import os >>> CESIUM_DIR = os.environ['CESIUMDIR'] >>> # Otherwise, you may specify the patch to Cesium here: >>> # CESIUM_DIR = '/provide/path/to/Cesium/'
- Generate a 3D movie of the routes:
>>> vrv.createCesium(assignments = myAssignments, ... nodes = myNodes, ... cesiumDir = CESIUM_DIR, ... problemDir = 'addAssignment2D_example')
-
addAssignment3D
(initAssignments=None, odID=1, objectID=None, modelFile=None, startTimeSec=0.0, startLoc=None, endLoc=None, takeoffSpeedMPS=None, cruiseSpeedMPS=None, landSpeedMPS=None, cruiseAltMetersAGL=None, routeType='square', climbRateMPS=None, descentRateMPS=None, earliestLandTime=-1, loiterPosition='arrivalAtAlt', leafletColor='orange', leafletWeight=3, leafletStyle='solid', leafletOpacity=0.8, leafletCurveType='straight', leafletCurvature=0, useArrows=True, modelScale=100, modelMinPxSize=75, cesiumColor='orange', cesiumWeight=3, cesiumStyle='solid', cesiumOpacity=0.8, ganttColor='darkgray', popupText=None)[source]¶ This function appends to an existing Assignments dataframe, or creates a new Assignments dataframe if initAssignments is None. The new rows in this dataframe describe all of the vehicle movements between given starting and ending locations, including timestamps indicating the departure and arrival times for each intermediate point.
Note
This function is for vehicles whose travel path includes changes in altitude (e.g., drones). For ground vehicles traveling on a ground plane, a 2-dimensional version of this function is provided by addAssignment2D().
- Parameters
odID (int, Optional, default as 1) – This field allows grouping of dataframe rows according to common origin/destination pairs. Arc segments which are part of the same origin/destination share the same odID.
objectID (int/string, Optional, default as None) – A descriptive name or index for a particular vehicle or object (e.g., ‘plane 1’, or ‘blue drone’).
modelFile (string, Optional, default as None) – The relative path and filename of the 3D model associated with this object. The 3D model, typically in the format of .gltf or .glb, will be visualized in Cesium. The path should be relative to the directory where Cesium is installed (i.e., the modelFile should exist within the Cesium root directory).
startTimeSec (float, Optional, default as 0.0) – The time, in seconds, at which the vehicle may leave the starting location.
startLoc (list, Required, default as 'None') – The starting location, expressed as either [lat, lon, alt] or [lat, lon]. If no altitude is provided, it will be assumed to be 0 meters above ground level.
endLoc (list, Required, default as 'None') – The ending location, expressed as either [lat, lon, alt] or [lat, lon]. If no altitude is provided, it will be assumed to be 0 meters above ground level.
takeoffSpeedMPS (float, Conditional, default as None) – The speed of the aircraft, in meters per second, during the “takeoff” phase. This will apply only to ‘square’ and ‘trapezoidal’ route types. The takeoff phase is the first component of these route types, and is associated with an increase in altitude. The takeoff speed is assumed to be constant, and ignores acceleration. See Flight Profile and Flight Path for additional information.
cruiseSpeedMPS (float, Conditional, default as None) – The speed of the aircraft, in meters per second, during the “cruising” phase. This will apply to all of the route options. Typically, the cruising phase occurs at a constant altitude, as specified by cruiseAltMetersAGL. However, for the ‘triangular’ route type, cruiseSpeedMPS specifies the constant travel speed during both the ascent to, and immediate descent from, the cruise altitude. In the ‘triangle’ route type, the aircraft has no horizontal travel at the cruise altitude. In all cases, the cruise speed is assumed to be constant, and ignores acceleration. See Flight Profile and Flight Path for additional information.
landSpeedMPS (float, Conditional, default as None) – The speed of the aircraft, in meters per second, during the “landing” phase. This will apply to only the ‘square’ and ‘trapezoidal’ route types. The landing phase is the last component of these route types, and is associated with a decrease in altitude. The landing speed is assumed to be constant, and ignore deceleration. See Flight Profile and Flight Path for additional information.
cruiseAltMetersAGL (float, Conditional, default as None) – The altitude, in meters above ground level, at which the aircraft is in the “cruise” phase. This phase is typically associated with horizontal movement at a fixed altitude. The exception is for the ‘triangular’ route type, in which case the aircraft instantaneously transitions from ascent to descent at the cruise altitude (i.e., there is no horizontal travel at this altitude). All but the ‘straight’ route type require/use the cruise altitude. See Flight Profile and Flight Path for additional details.
routeType (string, Optional, default as 'square') – Specifies the basic shape of the flight profile. Valid options include ‘square’, ‘triangular’, ‘trapezoidal’, and ‘straight’. The square profile involves a vertical takeoff to a cruising altitude, horizontal travel at the cruising altitude, and a vertical landing. The trapezoidal profile describes a takeoff phase in which the aircraft increases altitude and travels horizontally towards the destination until reaching the cruising altitude, horizontal travel at the cruising altitude, and a landing phase in which the aircraft decreases altitude and travels horizontally until reaching the destination. For the trapezoidal profile, the horizontal movement during the takeoff and landing phases is a function of the climbRateMPS and descentRateMPS, respectively. The triangular profile describes an ascent to the cruising altitude followed immediately by a descent to the destination. Finally, the straight profile describes straight-line flight directly from the starting location to the ending location; the altitudes of these two locations may differ. See Flight Profile and Flight Path for a description of these flight profiles.
climbRateMPS (float, Conditional, default as None) – This parameter is used only for the ‘trapezoidal’ route type, and is in units of meters per second. It describes the rate at which the aircraft increases its altitude, relative to the value of takeoffSpeedMPS. If climbRateMPS == takeoffSpeedMPS, then the takeoff phase will be purely vertical. If climbRateMPS is close to zero, then the takeoff phase will be characterized by a slow increase in altitude (and longer horizontal flight). The aircraft’s actual travel speed during the climb will be takeoffSpeedMPS. See Flight Profile and Flight Path for additional details.
descentRateMPS (float, Conditional, default as None) – This parameter is used only for the ‘trapezoidal’ route type, and is in units of meters per second. It describes the rate at which the aircraft decreases its altitude, relative to the value of landSpeedMPS. If descentRateMPS == landSpeedMPS, then the landing phase will be purely vertical. If descentRateMPS is close to zero, then the landing phase will be characterized by a slow decrease in altitude (and longer horizontal flight). The aircraft’s actual travel speed during the descent will be landSpeedMPS. See Flight Profile and Flight Path for additional details.
earliestLandTime (float, Optional, default as -1) – Specifies the earliest time, in seconds, that the vehicle is allowed to complete travel to the ending location. This parameter is useful in cases where time windows exist, or if a flying vehicle must wait for another vehicle (e.g., a drone that cannot land until a truck has arrived to recover it). The default value of -1 indicates that there is no restriction on the earliest landing time.
loiterPosition (string, Optional, default as 'arrivalAtAlt') – The position where the vehicle loiters if its un-delayed travel time from start to end would result in an arrival before earliestLandTime. Valid options are ‘beforeTakeoff’, ‘takeoffAtAlt’, ‘arrivalAtAlt’, ‘afterLand’. See Flight Profile and Flight Path for details.
leafletColor (string, Optional, default as "orange") – The color of the route when displayed in Leaflet. See Leaflet Style for a list of available colors.
leafletWeight (int, Optional, default as 3) – The pixel width of the route when displayed in Leaflet.
leafletStyle (string, Optional, default as 'solid') – The line style of the route when displayed in Leaflet. Valid options are ‘solid’, ‘dotted’, and ‘dashed’. See Leaflet Style for more information.
leafletOpacity (float in [0, 1], Optional, default as 0.8) – The opacity of the route when displayed in Leaflet. Valid values are in the range from 0 (invisible) to 1 (no transparency).
leafletCurveType (string, Optional, default as 'straight') – The type of curve to be shown on leaflet map for :ref:Arc dataframes (curves will not be applied to :ref:Assignments dataframes). The options are ‘Bezier’, ‘greatcircle’, and ‘straight’. If Bezier is provided, the leafletCurvature is also required. If greatcircle is provided, the arc follow the curvature of the Earth.
leafletCurvature (float in (-90, 90), Conditional, default as 45) – If leafletCurveType is ‘Bezier’, then leafletCurvature is required; otherwise this argument will not be used. The curvature specifies the angle between a straight line connecting the two nodes and the curved arc emanating from those two nodes. Therefore, this value should be in the open interval (-90, 90), although values in the (-45, 45) range tend to work best.
useArrows (bool, Optional, default as True) – Indicates whether arrows should be shown on the route when displayed in Leaflet.
modelScale (int, Optional, default as 100) – The scale of the 3D model (specified by the modelFile argument) when displayed in Cesium, such that 100 represents 100%.
modelMinPxSize (int, Optional, default as 75) – The minimum pixel size of the 3D model (specified by the modelFile argument) when displayed in Cesium. When zooming out, the model will not be smaller than this size; zooming in can result in a larger model.
cesiumColor (string, Optional, default as "orange") – The color of the route when displayed in Cesium. See Cesium Style for a list of available colors.
cesiumWeight (int, Optional, default as 3) – The pixel width of the route when displayed in Cesium.
cesiumStyle (string, Optional, default as 'solid') – The line style of the route when displayed in Cesium. Valid options are ‘solid’, ‘dotted’, and ‘dashed’. See Cesium Style for more information.
cesiumOpacity (float in [0, 1], Optional, default as 0.8) – The opacity of the route when displayed in Cesium. Valid values are in the range from 0 (invisible) to 1 (no transparency).
ganttColor (string, Optional, default as "darkgray") – The color of the route elements when displayed in a Gantt chart.
popupText (string, Optional, default as None) – Text (or HTML) that will be displayed when a user clicks on the arc in either Leaflet or Cesium.
- Returns
An Assignments dataframe containing an ordered sequence of paired GPS coordinates and altitudes describing the collection of straight-line segments required to travel from a start location to an end location.
- Return type
Assignments dataframe
Examples
- Import veroviz and check if it’s the latest version:
>>> import veroviz as vrv >>> vrv.checkVersion()
- Define 5 node locations, as [lat, lon] pairs:
>>> locs = [[42.8871085, -78.8731949], ... [42.8888311, -78.8649649], ... [42.8802158, -78.8660787], ... [42.8845705, -78.8762794], ... [42.8908031, -78.8770140]]
- Generate a nodes dataframe from these locations:
>>> myNodes = vrv.createNodesFromLocs(locs=locs) >>> myNodes
- View these nodes on a map:
>>> vrv.createLeaflet(nodes=myNodes)
- Example 1 – Assume a single drone delivers packages from node 1 to all other nodes.
>>> # Hard-code a solution: >>> mySolution = { ... 'drone': [[1,2,1], [1,3,1], [1,4,1], [1,5,1]] >>> }
- Define some information about our drone, for later use:
>>> vehicleProperties = { ... 'drone': {'modelPackage': 'veroviz/models/drone_package.gltf', ... 'modelEmpty': 'veroviz/models/drone.gltf', ... 'leafletColor': 'red', ... 'cesiumColor': 'red'}, >>> }
- Build the assignments for the drone deliveries:
>>> myAssignments = vrv.initDataframe('assignments') >>> >>> endTimeSec = 0.0 >>> for arc in mySolution['drone']: ... # Fly from i to j with a package: ... [myAssignments, endTimeSec] = vrv.addAssignment3D( ... initAssignments = myAssignments, ... objectID = 'drone', ... modelFile = vehicleProperties['drone']['modelPackage'], ... startLoc = list(myNodes[myNodes['id'] == arc[0]][['lat', 'lon']].values[0]), ... endLoc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... takeoffSpeedMPS = vrv.convertSpeed(30, 'miles', 'hr', 'meters', 'sec'), ... cruiseSpeedMPS = vrv.convertSpeed(80, 'miles', 'hr', 'meters', 'sec'), ... landSpeedMPS = vrv.convertSpeed( 5, 'miles', 'hr', 'meters', 'sec'), ... cruiseAltMetersAGL = vrv.convertDistance(350, 'feet', 'meters'), ... routeType = 'square', ... leafletColor = vehicleProperties['drone']['leafletColor'], ... cesiumColor = vehicleProperties['drone']['cesiumColor']) ... ... # Drop off a package ... myAssignments = vrv.addStaticAssignment( ... initAssignments = myAssignments, ... objectID = 'package %d' % (arc[1]), ... modelFile = '/veroviz/models/box_yellow.gltf', ... loc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... endTimeSec = -1) ... ... # Fly from j to k empty: ... [myAssignments, endTimeSec] = vrv.addAssignment3D( ... initAssignments = myAssignments, ... objectID = 'drone', ... modelFile = vehicleProperties['drone']['modelEmpty'], ... startLoc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... endLoc = list(myNodes[myNodes['id'] == arc[2]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... takeoffSpeedMPS = vrv.convertSpeed(30, 'miles', 'hr', 'meters', 'sec'), ... cruiseSpeedMPS = vrv.convertSpeed(80, 'miles', 'hr', 'meters', 'sec'), ... landSpeedMPS = vrv.convertSpeed( 5, 'miles', 'hr', 'meters', 'sec'), ... cruiseAltMetersAGL = vrv.convertDistance(350, 'feet', 'meters'), ... routeType = 'square', ... leafletColor = vehicleProperties['drone']['leafletColor'], ... cesiumColor = vehicleProperties['drone']['cesiumColor']) ... >>> myAssignments
- Show the nodes and assignments on a map:
>>> vrv.createLeaflet(nodes=myNodes, arcs=myAssignments)
- If you have saved your Cesium path as an environment variable, you may use os.environ to access it:
>>> import os >>> CESIUM_DIR = os.environ['CESIUMDIR'] >>> # Otherwise, you may specify the patch to Cesium here: >>> # CESIUM_DIR = '/provide/path/to/Cesium/'
- Create a 3D movie of the drone deliveries:
>>> vrv.createCesium(assignments = myAssignments, ... nodes = myNodes, ... cesiumDir = CESIUM_DIR, ... problemDir = 'addAssignment3D_example1')
- Example 2 – Coordinate deliveries with a drone launched from a truck
>>> # Hard-code a solution. >>> # The truck will visit nodes 1->3->5->1 >>> # The drone will launch from the truck at node 1, deliver to node 2, and return to the truck at node 3. >>> # The drone will then launch from the truck at 1, deliver to 4 and return to 5. >>> # The drone cannot land at nodes 3 and 5 until the truck has arrived. >>> mySolution = { ... 'drone': [[1,2,3], [3,4,5]], ... 'truck': [[1,3], [3,5], [5,1]] >>> }
- Define some information about our 2 vehicles, for use below:
>>> vehicleProperties = { ... 'drone': {'modelPackage': 'veroviz/models/drone_package.gltf', ... 'modelEmpty': 'veroviz/models/drone.gltf', ... 'leafletColor': 'red', ... 'cesiumColor': 'red'}, ... 'truck': {'model': 'veroviz/models/ub_truck.gltf', ... 'leafletColor': 'blue', ... 'cesiumColor': 'blue'} >>> }
>>> # This example assumes the use of ORS as the data provider. >>> # If you have saved your API key as an environment variable, you may use `os.environ` to access it: >>> import os >>> ORS_API_KEY = os.environ['ORSKEY'] >>> # Otherwise, you may specify your key here: >>> # ORS_API_KEY = 'YOUR_ORS_KEY_GOES_HERE'
>>> # Obtain the travel times for the truck: >>> [timeSecTruck, distMetersTruck] = vrv.getTimeDist2D( ... nodes = myNodes, ... routeType = 'fastest', ... dataProvider = 'ORS-online', ... dataProviderArgs = {'APIkey': ORS_API_KEY})
>>> # Obtain the travel times for the drone: >>> [timeSecDrone, groundDist, TotalDist] = vrv.getTimeDist3D( ... nodes = myNodes, ... takeoffSpeedMPS = vrv.convertSpeed(30, 'miles', 'hr', 'meters', 'sec'), ... cruiseSpeedMPS = vrv.convertSpeed(80, 'miles', 'hr', 'meters', 'sec'), ... landSpeedMPS = vrv.convertSpeed( 5, 'miles', 'hr', 'meters', 'sec'), ... cruiseAltMetersAGL = vrv.convertDistance(350, 'feet', 'meters'), ... routeType = 'square')
>>> # Find the coordination times for the truck and drone. >>> # These will be the earliest times that both the truck and drone can arrive at a node. >>> maxArrivalTime = {} >>> >>> # 1) The truck travels from 1 to 3; the drone travels from 1 to 2 to 3: >>> truckArrivalTime = timeSecTruck[1,3] >>> droneArrivalTime = timeSecDrone[1,2] + timeSecDrone[2,3] >>> maxArrivalTime[3] = max(truckArrivalTime, droneArrivalTime) >>> >>> # 2) The truck travels from 3 to 5; the drone travels from 3 to 4 to 5: >>> truckArrivalTime = maxArrivalTime[3] + timeSecTruck[3,5] >>> droneArrivalTime = maxArrivalTime[3] + timeSecDrone[3,4] + timeSecDrone[4,5] >>> maxArrivalTime[5] = max(truckArrivalTime, droneArrivalTime) >>> >>> # 3) Let's also capture the time at which the truck will return to node 1: >>> maxArrivalTime[1] = maxArrivalTime[5] + timeSecTruck[5,1] >>> >>> # maxArrival Time[1] is now the total time required to complete all of the deliveries >>> maxArrivalTime
- Build assignments for the drone deliveries:
>>> myAssignments = vrv.initDataframe('assignments') >>> >>> endTimeSec = 0.0 >>> for arc in mySolution['drone']: ... # Fly from i to j with a package: ... [myAssignments, endTimeSec] = vrv.addAssignment3D( ... initAssignments = myAssignments, ... objectID = 'drone', ... modelFile = vehicleProperties['drone']['modelPackage'], ... startLoc = list(myNodes[myNodes['id'] == arc[0]][['lat', 'lon']].values[0]), ... endLoc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... takeoffSpeedMPS = vrv.convertSpeed(30, 'miles', 'hr', 'meters', 'sec'), ... cruiseSpeedMPS = vrv.convertSpeed(80, 'miles', 'hr', 'meters', 'sec'), ... landSpeedMPS = vrv.convertSpeed( 5, 'miles', 'hr', 'meters', 'sec'), ... cruiseAltMetersAGL = vrv.convertDistance(350, 'feet', 'meters'), ... routeType = 'square', ... leafletColor = vehicleProperties['drone']['leafletColor'], ... cesiumColor = vehicleProperties['drone']['cesiumColor']) ... ... # Drop off a package ... myAssignments = vrv.addStaticAssignment( ... initAssignments = myAssignments, ... objectID = 'package %d' % (arc[1]), ... modelFile = '/veroviz/models/box_yellow.gltf', ... loc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... endTimeSec = -1) ... ... # Fly from j to k empty: ... [myAssignments, endTimeSec] = vrv.addAssignment3D( ... initAssignments = myAssignments, ... objectID = 'drone', ... modelFile = vehicleProperties['drone']['modelEmpty'], ... startLoc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... endLoc = list(myNodes[myNodes['id'] == arc[2]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... takeoffSpeedMPS = vrv.convertSpeed(30, 'miles', 'hr', 'meters', 'sec'), ... cruiseSpeedMPS = vrv.convertSpeed(80, 'miles', 'hr', 'meters', 'sec'), ... landSpeedMPS = vrv.convertSpeed( 5, 'miles', 'hr', 'meters', 'sec'), ... cruiseAltMetersAGL = vrv.convertDistance(350, 'feet', 'meters'), ... routeType = 'square', ... earliestLandTime = maxArrivalTime[arc[2]], ... loiterPosition = 'arrivalAtAlt', ... leafletColor = vehicleProperties['drone']['leafletColor'], ... cesiumColor = vehicleProperties['drone']['cesiumColor']) ... >>> myAssignments
- Build assignments for the truck route:
>>> endTimeSec = 0.0 >>> for arc in mySolution['truck']: ... [myAssignments, endTimeSec] = vrv.addAssignment2D( ... initAssignments = myAssignments, ... objectID = 'truck', ... modelFile = vehicleProperties['truck']['model'], ... startLoc = list(myNodes[myNodes['id'] == arc[0]][['lat', 'lon']].values[0]), ... endLoc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... leafletColor = vehicleProperties['truck']['leafletColor'], ... cesiumColor = vehicleProperties['truck']['cesiumColor'], ... routeType = 'fastest', ... dataProvider = 'ORS-online', ... dataProviderArgs = {'APIkey': ORS_API_KEY}) ... ... # If necessary, wait for the drone to arrive: ... if (endTimeSec < maxArrivalTime[arc[1]]): ... myAssignments = vrv.addStaticAssignment( ... initAssignments = myAssignments, ... objectID = 'truck', ... modelFile = vehicleProperties['truck']['model'], ... loc = list(myNodes[myNodes['id'] == arc[1]][['lat', 'lon']].values[0]), ... startTimeSec = endTimeSec, ... endTimeSec = maxArrivalTime[arc[1]]) ... ... endTimeSec = maxArrivalTime[arc[1]] >>> myAssignments
- Show the nodes and assignments on a map:
>>> vrv.createLeaflet(nodes=myNodes, arcs=myAssignments)
- Create a 3D movie of the drone deliveries:
>>> vrv.createCesium(assignments = myAssignments, ... nodes = myNodes, ... cesiumDir = CESIUM_DIR, ... problemDir = 'addAssignment3D_example1')
-
addStaticAssignment
(initAssignments=None, odID=1, objectID=None, modelFile=None, modelScale=100, modelMinPxSize=75, loc=None, startTimeSec=None, endTimeSec=None, ganttColor='darkgray', popupText=None)[source]¶ This function adds an “object” to an assignments dataframe. One use of this function is to add a package or other stationary 3D model to be displayed in Cesium. This function is also useful for holding a vehicle stationary at a location (e.g., during service or loitering).
- Parameters
initAssignments (Assignments dataframe, Optional, default as None) – If provided, the function will append a row to this dataframe.
odID (int, Optional, default as 1) – This field allows grouping of dataframe rows according to common origin/destination pairs. Arc segments which are part of the same origin/destination share the same odID.
objectID (int/string, Optional, default as None) – A descriptive name or index for this object. In the case of adding a stationary vehicle performing a service activity, the objectID should typically be the same as the objectID used by the vehicle when it was in motion.
modelFile (string, Optional, default as None) – The relative path and filename of the 3D model associated with this object. The 3D model, typically in the format of .gltf or .glb, will be visualized in Cesium. The path should be relative to the directory where Cesium is installed (i.e., the modelFile should exist within the Cesium root directory).
modelScale (int, Optional, default as 100) – The scale of the 3D model (specified by the modelFile argument) when displayed in Cesium, such that 100 represents 100%.
modelMinPxSize (int, Optional, default as 75) – The minimum pixel size of the 3D model (specified by the modelFile argument) when displayed in Cesium. When zooming out, the model will not be smaller than this size; zooming in can result in a larger model.
loc (list, Required, default as None) – The coordinate of the static object, expressed as either [lat, lon, alt] or [lat, lon]. If no altitude is provided, it will be assumed to be 0 meters above ground level.
startTimeSec (int, Required, default as None,) – Specifies the time at which this object appears.
endTimeSec (int, Required, default as None) – Specifies when the object is no longer displayed. To keep the object displayed forever, set endTimeSec = -1.
ganttColor (string, Optional, default as "darkgray") – The color of this assignment when displayed in a Gantt chart.
popupText (string, Optional, default as None) – Text (or HTML) that will be displayed when a user clicks on the arc in either Leaflet or Cesium.
- Returns
An assignments dataframe with a new row associated with this stationary object.
- Return type
Assignments pandas.dataframe
Example
- Import veroviz and check the latest version.
>>> import veroviz as vrv >>> import os
>>> vrv.checkVersion()
- Create two nodes.
>>> myNodes = vrv.createNodesFromLocs( ... locs = [[42.1538, -78.4253], ... [42.6343, -78.1146]]) >>> myNodes
- Move the truck from one node to the other.
>>> myAssignments = vrv.getShapepoints2D( ... odID = 0, ... objectID = 'truck', ... modelFile = 'veroviz/models/ub_truck.gltf', ... modelScale = 80, ... modelMinPxSize = 20, ... startLoc = list(myNodes.loc[0][['lat', 'lon']].values), ... endLoc = list(myNodes.loc[1][['lat', 'lon']].values), ... routeType = 'euclidean2D', ... dataProvider = None, ... speedMPS = vrv.convertSpeed(55, 'miles', 'hr', 'm', 's'))
- Make the truck wait at the destination.
>>> myAssignments = vrv.addStaticAssignment( ... initAssignments = myAssignments, ... odID = 0, ... objectID = 'truck', ... modelFile = 'veroviz/models/ub_truck.gltf', ... modelScale = 80, ... modelMinPxSize = 20, ... loc = list(myAssignments[myAssignments['objectID']=='truck'][['endLat', 'endLon']].values[0]), ... startTimeSec = myAssignments[myAssignments['objectID']=='truck']['endTimeSec'].values[0], ... endTimeSec = myAssignments[myAssignments['objectID']=='truck']['endTimeSec'].values[0] + 30)
- Drop off a package.
>>> myAssignments = vrv.addStaticAssignment( ... initAssignments = myAssignments, ... odID = 0, ... objectID = 'package', ... modelFile = 'veroviz/models/box_blue.gltf', ... modelScale = 50, ... modelMinPxSize = 10, ... loc = list(myAssignments[myAssignments['objectID']=='truck'][['endLat', 'endLon']].values[0]), ... startTimeSec = myAssignments[myAssignments['objectID']=='truck']['endTimeSec'].values[0] + 30, ... endTimeSec = -1)
- View in Leaflet. Note that we can’t see the truck waiting. Also, the package doesn’t show up in Leaflet.
>>> vrv.createLeaflet(nodes=myNodes, arcs=myAssignments)
- Create Cesium output, so we can observe our truck and package.
>>> vrv.createCesium( ... assignments = myAssignments, ... nodes = myNodes, ... startTime = '08:00:00', ... cesiumDir = os.environ['CESIUMDIR'], ... problemDir = 'static_object_demo')
-
createAssignmentsFromArcs2D
(initAssignments=None, arcs=None, serviceTimeSec=0.0, modelFile=None, modelScale=100, modelMinPxSize=75, startTimeSec=0.0, expDurationArgs=None, routeType='euclidean2D', speedMPS=None, leafletColor=None, leafletWeight=None, leafletStyle=None, leafletOpacity=None, leafletCurveType=None, leafletCurvature=None, useArrows=True, cesiumColor=None, cesiumWeight=None, cesiumStyle=None, cesiumOpacity=None, ganttColor='darkgray', ganttColorService='lightgray', popupText=None, dataProvider=None, dataProviderArgs=None)[source]¶ This function generates an “assignments” dataframe containing all of the “shapepoints” between successive arcs, including timestamps indicating the departure and arrival times for each shapepoint. Shapepoints are pairs of GPS coordinates that are connected by straight lines. For a particular origin and destination, numerous individual shapepoints can be combined to define a travel route along a road network.
Note
This function is for vehicles traveling on a ground plane (2-dimensional). For vehicles requiring an altitude component (e.g., drones), a 3D version of this function is provided by createAssignmentsFromArcs3D(). This function creates an assignments dataframe from an arcs dataframe. Similar functions are available to create an assignments dataframe from a sequence of nodes (createShapepointsFromNodeSeq2D()) or from a sequence of locations (createShapepointsFromLocSeq2D()).
- Parameters
initAssignments (Assignments dataframe, Optional, default as None) – If provided, the function will append rows to this dataframe.
arcs (Arcs, Required) – A Arcs dataframe, from which the assignments dataframe will be generated.
serviceTimeSec (float, Optional, default as 0.0) – Specifies a duration, in seconds, that the vehicle will be stationary at each destination location in the arcs dataframe.
modelFile (string, Optional, default as None) – The relative path and filename of the 3D model associated with the object described in the arcs dataframe. The 3D model, typically in the format of .gltf or .glb, will be visualized in Cesium. The path should be relative to the directory where Cesium is installed (i.e., the modelFile should exist within the Cesium root directory).
modelScale (int, Optional, default as 100) – The scale of the 3D model (specified by the modelFile argument) when displayed in Cesium, such that 100 represents 100%.
modelMinPxSize (int, Optional, default as 75) – The minimum pixel size of the 3D model (specified by the modelFile argument) when displayed in Cesium. When zooming out, the model will not be smaller than this size; zooming in can result in a larger model.
startTimeSec (float, Optional, default as 0.0) – The time, in seconds, at which the vehicle may leave the starting location.
expDurationArgs (dictionary, Optional, default as None) – Sometimes there are inconsistencies between the travel times specified in the turn-by-turn navigation (i.e., shapepoints) and the travel matrices (i.e., from the getTimeDist functions). The expDurationArgs field may take two different values. First, if expDurationArgs is None (default), the travel times will be based solely on the turn-by-turn times. Second, if expDurationArgs is a dictionary with a key of ‘getTravelTimes’ and a corresponding value of True, then this function will call the getTimeDist2D() function for each origin/destination pair (i.e., for each row of the arcs dataframe). In this case, all shapepoint travel times will be adjusted/redistributed to match the resulting values.
routeType (string, Optional, default as 'euclidean2D') – This describes a characteristic of the travel mode. Possible values are: ‘euclidean2D’, ‘manhattan’, ‘fastest’, ‘shortest’, ‘pedestrian’, ‘cycling’, and ‘truck’. The ‘euclidean2D’ and ‘manhattan’ options are calculated directly from GPS coordinates, without a road network. Neither of these two options require a data provider. However, the other options rely on road network information and require a data provider. Furthermore, some of those other options are not supported by all data providers. See Data Providers for details.
speedMPS (float, Conditional, default as None) – Speed of the vehicle, in units of meters per second. For route types that are not road-network based (i.e., ‘euclidean2D’ and ‘manhattan’), this field is required to calculate travel times. Otherwise, if a route type already incorporates travel speeds from road network data, (i.e., ‘fastest’, ‘shortest’, and ‘pedestrain’), this input argument may be ignored. If provided, speedMPS will override travel speed data used by the route type option.
leafletColor (string, Optional, default as None) – Overrides the leafletColor column of the input Arcs dataframe. If provided, all arcs will be displayed with this color. See Leaflet Style for a list of available colors.
leafletWeight (int, Optional, default as None) – Overrides the leafletWeight column of the input Arcs dataframe. If provided, all arcs will be displayed with this line thickness (in pixels).
leafletStyle (string, Optional, default as None) – Overrides the leafletStyle column of the input Arcs dataframe. If provided, all arcs will be displayed with this type. Valid options are ‘solid’, ‘dotted’, or ‘dashed’. See Leaflet Style for more information.
leafletOpacity (float in [0, 1], Optional, default as None) – Overrides the leafletOpacity column of the input Arcs dataframe. If provided, each arc will be displayed with this opacity. Valid values are in the range from 0 (invisible) to 1 (no transparency).
leafletCurveType (string, Optional, default as None) – Overrides the leafletCurveType column of the input Arcs dataframe, if provided. The type of curve to be shown on leaflet map for :ref:Arc dataframes (curves will not be applied to :ref:Assignments dataframes). The options are ‘Bezier’, ‘greatcircle’, and ‘straight’. If Bezier is provided, the leafletCurvature is also required. If greatcircle is provided, the arc follow the curvature of the Earth.
leafletCurvature (float in (-90, 90), Conditional, default as None) – Overrides the leafletCurvature column of the input Arcs dataframe, if provided. If leafletCurveType is ‘Bezier’, then leafletCurvature is required; otherwise this argument will not be used. The curvature specifies the angle between a straight line connecting the two nodes and the curved arc emanating from those two nodes. Therefore, this value should be in the open interval (-90, 90), although values in the (-45, 45) range tend to work best.
useArrows (boolean, Optional, default as None) – Overrides the useArrows column of the input Arcs dataframe. Indicates whether arrows should be shown on the route when displayed in Leaflet.
cesiumColor (string, Optional, default as None) – Overrides the cesiumColor column of the input Arcs dataframe. This will define the color of all arcs displayed in Cesium. See Cesium Style for the collection of available colors.
cesiumWeight (int, Optional, default as None) – Overrides the cesiumWeight column of the input Arcs dataframe. This will define the weight (in pixels) of all arcs displayed in Cesium. See Cesium Style for more information.
cesiumStyle (string, Optional, default as None) – Overrides the cesiumStyle column of the input Arcs dataframe. This will define the style of all arcs displayed in Cesium. See Cesium Style for available options.
cesiumOpacity (float in [0, 1], Optional, default as None) – Overrides the cesiumOpacity column of the input Arcs dataframe. This will define the opacity of all arcs displayed in Cesium. See Cesium Style for more information.
ganttColor (string, Optional, default as "darkgray") – The color of the route elements when displayed in a Gantt chart.
ganttColorService (string, Optional, default as "lightgray") – The color of displayed in a Gantt chart for service activities.
popupText (string, Optional, default as None) – Text (or HTML) that will be displayed when a user clicks on the arc in either Leaflet or Cesium.
dataProvider (string, Conditional, default as None) – Specifies the data source to be used for obtaining the shapepoints. See Data Providers for options and requirements.
dataProviderArgs (dictionary, Conditional, default as None) – For some data providers, additional parameters are required (e.g., API keys or database names). See Data Providers for the additional arguments required for each supported data provider.
- Returns
An Assignments dataframe containing an ordered sequence of paired GPS coordinates describing the collection of straight-line segments required to travel through all arcs in the provided Arcs dataframe.
- Return type
Assignments dataframe
Examples
- Import veroviz and check if it’s the latest version:
>>> import veroviz as vrv >>> vrv.checkVersion()
- Generate arcs from a given ordered list of coordinates:
>>> arcs = vrv.createArcsFromLocSeq( ... locSeq=[[42.3538, -78.4253, 30], ... [42.3465, -78.4234, 30], ... [42.3343, -78.4146, 40]]) >>> arcs
- Display the arcs on a Leaflet map:
>>> vrv.createLeaflet(arcs=arcs)
- The following examples assume the use of ORS as the data provider. If you have saved your API key as an environment variable, you may use os.environ to access it:
>>> import os >>> ORS_API_KEY = os.environ['ORSKEY'] >>> # Otherwise, you may specify your key here: >>> # ORS_API_KEY = 'YOUR_ORS_KEY_GOES_HERE'
- Generate an assignments dataframe from the arcs dataframe:
>>> myAssignments = vrv.createAssignmentsFromArcs2D( ... arcs = arcs, ... modelFile = 'veroviz/models/car_blue.gltf', ... routeType = 'fastest', ... dataProvider = 'ors-online', ... dataProviderArgs = {'APIkey': ORS_API_KEY}, ... leafletColor = 'blue') >>> myAssignments
- Display the assignments on a map:
>>> vrv.createLeaflet(arcs=myAssignments)
-
createAssignmentsFromLocSeq2D
(initAssignments=None, locSeq=None, serviceTimeSec=0.0, odID=1, objectID=None, modelFile=None, modelScale=100, modelMinPxSize=75, startTimeSec=0.0, expDurationArgs=None, routeType='euclidean2D', speedMPS=None, leafletColor='orange', leafletWeight=3, leafletStyle='solid', leafletOpacity=0.8, leafletCurveType='straight', leafletCurvature=0, useArrows=True, cesiumColor='orange', cesiumWeight=3, cesiumStyle='solid', cesiumOpacity=0.8, ganttColor='darkgray', ganttColorService='lightgray', popupText=None, dataProvider=None, dataProviderArgs=None)[source]¶ This function generates an “assignments” dataframe containing all of the “shapepoints” between successive locations, including timestamps indicating the departure and arrival times for each shapepoint. Shapepoints are pairs of GPS coordinates that are connected by straight lines. For a particular origin and destination, numerous individual shapepoints can be combined to define a travel route along a road network.
Note
This function is for vehicles traveling on a ground plane (2-dimensional). For vehicles requiring an altitude component (e.g., drones), a 3D version of this function is provided by createAssignmentsFromLocSeq3D(). This function creates an assignments dataframe from a sequence of [lat, lon] locations. Similar functions are available to create an assignments dataframe from an arcs dataframe (createShapepointsFromArcs2D()) or from a sequence of nodes (createShapepointsFromNodeSeq2D()).
- Parameters
initAssignments (Assignments dataframe, Optional, default as None) – If provided, the function will append rows to this dataframe.
locSeq (list of lists, Required, default as None) – An ordered list of locations that will be converted into an Arcs dataframe. The list should be formated as [[lat1, lon1], [lat2, lon2], …, [latn, lonn]] or [[lat1, lon1, alt1], [lat2, lon2, alt2], …, [latn, lonn, altn]]. If provided, altitude values will be ignored.
serviceTimeSec (float, Optional, default as 0.0) – Specifies a duration, in seconds, that the vehicle will be stationary at each destination node. This service (stationary) time will not be applied to the first node in nodeSeq.
odID (int, Optional, default as 1) – This field allows grouping of dataframe rows according to common origin/destination pairs. Arc segments which are part of the same origin/destination share the same odID.
objectID (int/string, Optional, default as None) – A descriptive name or index for a particular vehicle or object (e.g., ‘truck 1’, or ‘red car’).
modelFile (string, Optional, default as None) – The relative path and filename of the 3D model associated with this object. The 3D model, typically in the format of .gltf or .glb, will be visualized in Cesium. The path should be relative to the directory where Cesium is installed (i.e., the modelFile should exist within the Cesium root directory).
startTimeSec (float, Optional, default as 0.0) – The time, in seconds, at which the vehicle may leave the starting location.
expDurationArgs (dictionary, Optional, default as None) – Sometimes there are inconsistencies between the travel times specified in the turn-by-turn navigation (i.e., shapepoints) and the travel matrices (i.e., from the getTimeDist functions). The expDurationArgs field may take two different values. First, if expDurationArgs is None (default), the travel times will be based solely on the turn-by-turn times. Second, if expDurationArgs is a dictionary with a key of ‘getTravelTimes’ and a corresponding value of True, then this function will call the getTimeDist2D() function for each origin/destination pair. In this case, all shapepoint travel times will be adjusted/redistributed to match the resulting values.
routeType (string, Optional, default as 'euclidean2D') – This describes a characteristic of the travel mode. Possible values are: ‘euclidean2D’, ‘manhattan’, ‘fastest’, ‘shortest’, ‘pedestrian’, ‘cycling’, and ‘truck’. The ‘euclidean2D’ and ‘manhattan’ options are calculated directly from GPS coordinates, without a road network. Neither of these two options require a data provider. However, the other options rely on road network information and require a data provider. Furthermore, some of those other options are not supported by all data providers. See Data Providers for details.
speedMPS (float, Conditional, default as None) – Speed of the vehicle, in units of meters per second. For route types that are not road-network based (i.e., ‘euclidean2D’ and ‘manhattan’), this field is required to calculate travel times. Otherwise, if a route type already incorporates travel speeds from road network data, (i.e., ‘fastest’, ‘shortest’, and ‘pedestrain’), this input argument may be ignored. If provided, speedMPS will override travel speed data used by the route type option.
leafletColor (string, Optional, default as "orange") – The color of the route when displayed in Leaflet. See Leaflet Style for a list of available colors.
leafletWeight (int, Optional, default as 3) – The pixel width of the route when displayed in Leaflet.
leafletStyle (string, Optional, default as 'solid') – The line style of the route when displayed in Leaflet. Valid options are ‘solid’, ‘dotted’, and ‘dashed’. See Leaflet Style for more information.
leafletOpacity (float in [0, 1], Optional, default as 0.8) – The opacity of the route when displayed in Leaflet. Valid values are in the range from 0 (invisible) to 1 (no transparency).
leafletCurveType (string, Optional, default as 'straight') – The type of curve to be shown on leaflet map for :ref:Arc dataframes (curves will not be applied to :ref:Assignments dataframes). The options are ‘Bezier’, ‘greatcircle’, and ‘straight’. If Bezier is provided, the leafletCurvature is also required. If greatcircle is provided, the arc follow the curvature of the Earth.
leafletCurvature (float in (-90, 90), Conditional, default as 45) – If leafletCurveType is ‘Bezier’, then leafletCurvature is required; otherwise this argument will not be used. The curvature specifies the angle between a straight line connecting the two nodes and the curved arc emanating from those two nodes. Therefore, this value should be in the open interval (-90, 90), although values in the (-45, 45) range tend to work best.
useArrows (bool, Optional, default as True) – Indicates whether arrows should be shown on the route when displayed in Leaflet.
modelScale (int, Optional, default as 100) – The scale of the 3D model (specified by the modelFile argument) when displayed in Cesium, such that 100 represents 100%.
modelMinPxSize (int, Optional, default as 75) – The minimum pixel size of the 3D model (specified by the modelFile argument) when displayed in Cesium. When zooming out, the model will not be smaller than this size; zooming in can result in a larger model.
cesiumColor (string, Optional, default as "orange") – The color of the route when displayed in Cesium. See Cesium Style for a list of available colors.
cesiumWeight (int, Optional, default as 3) – The pixel width of the route when displayed in Cesium.
cesiumStyle (string, Optional, default as 'solid') – The line style of the route when displayed in Cesium. Valid options are ‘solid’, ‘dotted’, and ‘dashed’. See Cesium Style for more information.
cesiumOpacity (float in [0, 1], Optional, default as 0.8) – The opacity of the route when displayed in Cesium. Valid values are in the range from 0 (invisible) to 1 (no transparency).
ganttColor (string, Optional, default as "darkgray") – The color of the route elements when displayed in a Gantt chart.
ganttColorService (string, Optional, default as "lightgray") – The color of displayed in a Gantt chart for service activities.
popupText (string, Optional, default as None) – Text (or HTML) that will be displayed when a user clicks on the arc in either Leaflet or Cesium.
dataProvider (string, Conditional, default as None) – Specifies the data source to be used for obtaining the shapepoints. See Data Providers for options and requirements.
dataProviderArgs (dictionary, Conditional, default as None) – For some data providers, additional parameters are required (e.g., API keys or database names). See Data Providers for the additional arguments required for each supported data provider.
- Returns
An Assignments dataframe containing an ordered sequence of paired GPS coordinates describing the collection of straight-line segments required to travel through the provided sequence of locations.
- Return type
Assignments dataframe
Examples
- Import veroviz and check if it’s the latest version:
>>> import veroviz as vrv >>> vrv.checkVersion()
- The following examples assume the use of ORS as the data provider. If you have saved your API key as an environment variable, you may use os.environ to access it:
>>> import os >>> ORS_API_KEY = os.environ['ORSKEY'] >>> # Otherwise, you may specify your key here: >>> # ORS_API_KEY = 'YOUR_ORS_KEY_GOES_HERE'
- Specify a sequence of [lat, lon] or [lat, lon, alt] locations.
>>> locs = [ ... [42.1538, -78.4253, 30], ... [42.3465, -78.6234, 30], ... [42.6343, -78.1146, 40], ... [42.1538, -78.4253, 30]]
- Example 1 - A simple example using Euclidean travel, and no service times. The assignments dataframe will have 3 rows.
>>> assignmentsDF = vrv.createAssignmentsFromLocSeq2D( ... locSeq = locs, ... serviceTimeSec = 0.0, ... objectID = 'Blue Car', ... modelFile = 'veroviz/models/car_blue.gltf', ... routeType = 'euclidean2D', ... speedMPS = 10) >>> assignmentsDF
- Example 2 - The vehicle will follow the road network, resulting in an assignments dataframe with significantly more than 3 rows. The vehicle will remain stationary at the destination locations. The travel time for each origin/destination pair will be calculated separately.
>>> # Make our car wait for 65 seconds before starting: >>> assignmentsDF = vrv.addStaticAssignment( ... odID = 0, ... objectID = 'Blue Car', ... modelFile = 'veroviz/models/car_blue.gltf', ... loc = locs[0], ... startTimeSec = 0.0, ... endTimeSec = 65.0)
>>> # This example includes all of the available input arguments: >>> newAssignmentsDF = vrv.createAssignmentsFromLocSeq2D( ... initAssignments = assignmentsDF, ... locSeq = locs, ... serviceTimeSec = 20.0, ... odID = 1, ... objectID = 'Blue Car', ... modelFile = 'veroviz/models/car_blue.gltf', ... modelScale = 100, ... modelMinPxSize = 75, ... startTimeSec = 65.0, ... expDurationArgs = {'getTravelTimes': True}, ... routeType = 'fastest', ... speedMPS = None, ... leafletColor = 'blue', ... leafletWeight = 3, ... leafletStyle = 'dashed', ... leafletOpacity = 0.8, ... leafletCurveType = 'straight', ... leafletCurvature = None, ... useArrows = True, ... cesiumColor = 'blue', ... ganttColorService = 'green', ... cesiumWeight = 3, ... cesiumStyle = 'solid', ... cesiumOpacity = 0.8, ... ganttColor = 'blue', ... popupText = 'Blue Car Route', ... dataProvider = 'ORS-online', ... dataProviderArgs = {'APIkey' : ORS_API_KEY}) >>> newAssignmentsDF
- Generate a Nodes dataframe from our first three locations (the fourth location is a duplicate of the first). See
generateNodes()
for other methods to generate “nodes” dataframes. >>> exampleNodes = vrv.createNodesFromLocs(locs=locs[0:3])
- View the assignments in Leaflet:
>>> vrv.createLeaflet(arcs=newAssignmentsDF, nodes=exampleNodes)
- View the assignments in Cesium:
>>> vrv.createCesium( ... assignments = newAssignmentsDF, ... nodes = exampleNodes, ... startTime = '08:00:00', ... cesiumDir = os.environ['CESIUMDIR'], ... problemDir = 'createAssignments_example')
-
createAssignmentsFromNodeSeq2D
(initAssignments=None, nodeSeq=None, nodes=None, serviceTimeSec=0.0, odID=1, objectID=None, modelFile=None, modelScale=100, modelMinPxSize=75, startTimeSec=0.0, expDurationArgs=None, routeType='euclidean2D', speedMPS=None, leafletColor='orange', leafletWeight=3, leafletStyle='solid', leafletOpacity=0.8, leafletCurveType='straight', leafletCurvature=0, useArrows=True, cesiumColor='orange', cesiumWeight=3, cesiumStyle='solid', cesiumOpacity=0.8, ganttColor='darkgray', ganttColorService='lightgray', popupText=None, dataProvider=None, dataProviderArgs=None)[source]¶ This function generates an “assignments” dataframe containing all of the “shapepoints” between successive node locations, including timestamps indicating the departure and arrival times for each shapepoint. Shapepoints are pairs of GPS coordinates that are connected by straight lines. For a particular origin and destination, numerous individual shapepoints can be combined to define a travel route along a road network.
Note
This function is for vehicles traveling on a ground plane (2-dimensional). For vehicles requiring an altitude component (e.g., drones), a 3D version of this function is provided by createAssignmentsFromNodeSeq3D(). This function creates an assignments dataframe from a sequence of nodes. Similar functions are available to create an assignments dataframe from an arcs dataframe (createShapepointsFromArcs2D()) or from a sequence of locations (createShapepointsFromLocSeq2D()).
- Parameters
initAssignments (Assignments dataframe, Optional, default as None) – If provided, the function will append rows to this dataframe.
nodeSeq (list, Required) – An ordered list of node IDs. These IDs must be included in the id column of the Nodes dataframe specified in the nodes input argument to this function. The format for nodeSeq is [node_id_1, node_id_2, …].
nodes (Nodes, Required) – A Nodes dataframe, which must contain the individual node IDs specified in the nodeSeq input argument.
serviceTimeSec (float, Optional, default as 0.0) – Specifies a duration, in seconds, that the vehicle will be stationary at each destination node. This service (stationary) time will not be applied to the first node in nodeSeq.
odID (int, Optional, default as 1) – This field allows grouping of dataframe rows according to common origin/destination pairs. Arc segments which are part of the same origin/destination share the same odID.
objectID (int/string, Optional, default as None) – A descriptive name or index for a particular vehicle or object (e.g., ‘truck 1’, or ‘red car’).
modelFile (string, Optional, default as None) – The relative path and filename of the 3D model associated with this object. The 3D model, typically in the format of .gltf or .glb, will be visualized in Cesium. The path should be relative to the directory where Cesium is installed (i.e., the modelFile should exist within the Cesium root directory).
startTimeSec (float, Optional, default as 0.0) – The time, in seconds, at which the vehicle may leave the starting location.
expDurationArgs (dictionary, Optional, default as None) – Sometimes there are inconsistencies between the travel times specified in the turn-by-turn navigation (i.e., shapepoints) and the travel matrices (i.e., from the getTimeDist functions). The expDurationArgs field may take three different values. First, if expDurationArgs is None (default), the travel times will be based solely on the turn-by-turn times. Second, if expDurationArgs is a dictionary with a key of ‘timeSecDict’ and a corresponding value of a time dictionary (as output by getTimeDist2D()), then all shapepoint travel time will be adjusted/redistributed to match the values in the time dictionary. Finally, if expDurationArgs is a dictionary with a key of ‘getTravelTimes’ and a corresponding value of True, then this function will call the getTimeDist2D() function for each origin/destination pair. In this case, all shapepoint travel times will be adjusted/redistributed to match the resulting values.
routeType (string, Optional, default as 'euclidean2D') – This describes a characteristic of the travel mode. Possible values are: ‘euclidean2D’, ‘manhattan’, ‘fastest’, ‘shortest’, ‘pedestrian’, ‘cycling’, and ‘truck’. The ‘euclidean2D’ and ‘manhattan’ options are calculated directly from GPS coordinates, without a road network. Neither of these two options require a data provider. However, the other options rely on road network information and require a data provider. Furthermore, some of those other options are not supported by all data providers. See Data Providers for details.
speedMPS (float, Conditional, default as None) – Speed of the vehicle, in units of meters per second. For route types that are not road-network based (i.e., ‘euclidean2D’ and ‘manhattan’), this field is required to calculate travel times. Otherwise, if a route type already incorporates travel speeds from road network data, (i.e., ‘fastest’, ‘shortest’, and ‘pedestrain’), this input argument may be ignored. If provided, speedMPS will override travel speed data used by the route type option.
leafletColor (string, Optional, default as "orange") – The color of the route when displayed in Leaflet. See Leaflet Style for a list of available colors.
leafletWeight (int, Optional, default as 3) – The pixel width of the route when displayed in Leaflet.
leafletStyle (string, Optional, default as 'solid') – The line style of the route when displayed in Leaflet. Valid options are ‘solid’, ‘dotted’, and ‘dashed’. See Leaflet Style for more information.
leafletOpacity (float in [0, 1], Optional, default as 0.8) – The opacity of the route when displayed in Leaflet. Valid values are in the range from 0 (invisible) to 1 (no transparency).
leafletCurveType (string, Optional, default as 'straight') – The type of curve to be shown on leaflet map for :ref:Arc dataframes (curves will not be applied to :ref:Assignments dataframes). The options are ‘Bezier’, ‘greatcircle’, and ‘straight’. If Bezier is provided, the leafletCurvature is also required. If greatcircle is provided, the arc follow the curvature of the Earth.
leafletCurvature (float in (-90, 90), Conditional, default as 45) – If leafletCurveType is ‘Bezier’, then leafletCurvature is required; otherwise this argument will not be used. The curvature specifies the angle between a straight line connecting the two nodes and the curved arc emanating from those two nodes. Therefore, this value should be in the open interval (-90, 90), although values in the (-45, 45) range tend to work best.
useArrows (bool, Optional, default as True) – Indicates whether arrows should be shown on the route when displayed in Leaflet.
modelScale (int, Optional, default as 100) – The scale of the 3D model (specified by the modelFile argument) when displayed in Cesium, such that 100 represents 100%.
modelMinPxSize (int, Optional, default as 75) – The minimum pixel size of the 3D model (specified by the modelFile argument) when displayed in Cesium. When zooming out, the model will not be smaller than this size; zooming in can result in a larger model.
cesiumColor (string, Optional, default as "orange") – The color of the route when displayed in Cesium. See Cesium Style for a list of available colors.
cesiumWeight (int, Optional, default as 3) – The pixel width of the route when displayed in Cesium.
cesiumStyle (string, Optional, default as 'solid') – The line style of the route when displayed in Cesium. Valid options are ‘solid’, ‘dotted’, and ‘dashed’. See Cesium Style for more information.
cesiumOpacity (float in [0, 1], Optional, default as 0.8) – The opacity of the route when displayed in Cesium. Valid values are in the range from 0 (invisible) to 1 (no transparency).
ganttColor (string, Optional, default as "darkgray") – The color of the route elements when displayed in a Gantt chart.
ganttColorService (string, Optional, default as "lightgray") – The color of displayed in a Gantt chart for service activities.
popupText (string, Optional, default as None) – Text (or HTML) that will be displayed when a user clicks on the arc in either Leaflet or Cesium.
dataProvider (string, Conditional, default as None) – Specifies the data source to be used for obtaining the shapepoints. See Data Providers for options and requirements.
dataProviderArgs (dictionary, Conditional, default as None) – For some data providers, additional parameters are required (e.g., API keys or database names). See Data Providers for the additional arguments required for each supported data provider.
- Returns
An Assignments dataframe containing an ordered sequence of paired GPS coordinates describing the collection of straight-line segments required to travel through the provided sequence of nodes.
- Return type
Assignments dataframe
Examples
- Import veroviz and check if it’s the latest version:
>>> import veroviz as vrv >>> vrv.checkVersion()
- The following examples assume the use of ORS as the data provider. If you have saved your API key as an environment variable, you may use os.environ to access it:
>>> import os >>> ORS_API_KEY = os.environ['ORSKEY'] >>> # Otherwise, you may specify your key here: >>> # ORS_API_KEY = 'YOUR_ORS_KEY_GOES_HERE'
- Generate a Nodes dataframe from a list of coordinates. See
generateNodes()
for other methods to generate “nodes” dataframes. >>> locs = [ ... [42.1538, -78.4253], ... [42.3465, -78.6234], ... [42.6343, -78.1146]] >>> exampleNodes = vrv.createNodesFromLocs(locs=locs)
- Example 1 - A simple example using Euclidean travel, and no service times. The assignments dataframe will have 3 rows.
>>> assignmentsDF = vrv.createAssignmentsFromNodeSeq2D( ... nodeSeq = [1, 3, 2, 1], ... nodes = exampleNodes, ... serviceTimeSec = 0.0, ... objectID = 'Blue Car', ... modelFile = 'veroviz/models/car_blue.gltf', ... routeType = 'euclidean2D', ... speedMPS = 10) >>> assignmentsDF
- Example 2 - The vehicle will follow the road network, resulting in an assignments dataframe with significantly more than 3 rows. The vehicle will remain stationary at nodes 3, 2, and 1 (the destination nodes). The travel time for each origin/destination pair will be calculated separately.
>>> assignmentsDF = vrv.createAssignmentsFromNodeSeq2D( ... initAssignments = None, ... nodeSeq = [1, 3, 2, 1], ... nodes = exampleNodes, ... serviceTimeSec = 20.0, ... odID = 1, ... objectID = 'Blue Car', ... modelFile = 'veroviz/models/car_blue.gltf', ... expDurationArgs = {'getTravelTimes': True}, ... routeType = 'fastest', ... dataProvider = 'ORS-online', ... dataProviderArgs = {'APIkey' : ORS_API_KEY}) >>> assignmentsDF
- Example 3 - The vehicle will first wait at the starting location (node 1) for 65 seconds. It will then visit nodes 3 and 2 before returning to node 1. At each of those nodes, the vehicle will remain stationary for a 20-second service time. The travel time between each pair of nodes will be determined by the times in the timeSec matrix.
>>> # Generate a matrix of travel times: >>> [timeSec, distMeters] = vrv.getTimeDist2D( ... nodes = exampleNodes, ... matrixType = 'all2all', ... outputDistUnits = 'meters', ... outputTimeUnits = 'seconds', ... routeType = 'fastest', ... speedMPS = None, ... dataProvider = 'ORS-online', ... dataProviderArgs = {'APIkey' : ORS_API_KEY})
>>> # Make our car wait for 65 seconds before starting: >>> assignmentsDF = vrv.addStaticAssignment( ... odID = 0, ... objectID = 'Blue Car', ... modelFile = 'veroviz/models/car_blue.gltf', ... loc = [exampleNodes.loc[exampleNodes['id'] == 1]['lat'].values[0], ... exampleNodes.loc[exampleNodes['id'] == 1]['lon'].values[0]], ... startTimeSec = 0.0, ... endTimeSec = 65.0)
>>> # This example includes all of the available input arguments: >>> newAssignmentsDF = vrv.createAssignmentsFromNodeSeq2D( ... initAssignments = assignmentsDF, ... nodeSeq = [1, 3, 2, 1], ... nodes = exampleNodes, ... serviceTimeSec = 20.0, ... odID = 1, ... objectID = 'Blue Car', ... modelFile = 'veroviz/models/car_blue.gltf', ... modelScale = 100, ... modelMinPxSize = 75, ... startTimeSec = 65.0, ... expDurationArgs = {'timeSecDict': timeSec}, ... routeType = 'fastest', ... speedMPS = None, ... leafletColor = 'blue', ... leafletWeight = 3, ... leafletStyle = 'dashed', ... leafletOpacity = 0.8, ... useArrows = True, ... cesiumColor = 'blue', ... cesiumWeight = 3, ... cesiumStyle = 'solid', ... cesiumOpacity = 0.8, ... dataProvider = 'ORS-online', ... dataProviderArgs = {'APIkey' : ORS_API_KEY}) >>> newAssignmentsDF
- View the assignments in Leaflet:
>>> vrv.createLeaflet(arcs=newAssignmentsDF, nodes=exampleNodes)
- View the assignments in Cesium:
>>> vrv.createCesium( ... assignments = newAssignmentsDF, ... nodes = exampleNodes, ... startTime = '08:00:00', ... cesiumDir = os.environ['CESIUMDIR'], ... problemDir = 'createAssignments_example')