veroviz.createCesium module

createCesium(assignments=None, nodes=None, startDate=None, startTime='08:00:00', postBuffer=30, cesiumDir=None, problemDir=None, nodeColor=None, nodeStyle=None, pathColor=None, pathWeight=None, pathStyle=None, pathOpacity=None)[source]

This function generates several files required to view a solution in Cesium. The function requires assignments and/or nodes dataframes as input.

Parameters
  • assignments (Assignments, Conditional, assignments and nodes can not be None at the same time) – An Assignments dataframe describing vehicle movement over time. The assignments will be displayed as routes/paths in Cesium. If a 3D model is defined in the modelFile column of the assignments dataframe, this object will also be displayed.

  • nodes (Nodes, Conditional, assignments and nodes can not be None at the same time) – A Nodes dataframe describing the locations of nodes. These nodes will be displayed on the map in Cesium.

  • startDate (string, Optional, format is "YYYY-MM-DD", default as today) – Defines the start date to be displayed in Cesium.

  • startTime (string, Optional, format is "HH:MM:SS", default as '08:00:00') – Defines the time at which the Cesium video begins, on the start date.

  • postBuffer (int, Optional, default as 30) – Specifies the additional time (in seconds) that the Cesium video will continue to run after the last assignment is completed.

  • cesiumDir (string, Required, default as None) – This should be the full absolute path to the directory where Cesium is installed. For example, for Windows it might be “D:/Cesium”; for Linux it might be “/home/user/Cesium”.

  • problemDir (string, Required, default as None) – The path name of the generated problem directory. This path is relative to the root of Cesium. For example, if cesiumDir = ‘/home/user/Cesium’ and problemDir = ‘veroviz/problems/TSP’ then the files will be generated in the directory ‘/home/user/Cesium/veroviz/problems/TSP’.

  • nodeColor (string, Optional, default as None) – Overrides the cesiumColor column of the input nodes dataframe. This will define the color of all nodes displayed in Cesium. See Cesium Style for the collection of available colors.

  • nodeStyle (string, Optional, default as None) – Overrides the cesiumIconType column of the input nodes dataframe. Currently, the only option is ‘pin’.

  • pathColor (string, Optional, default as None) – Overrides the cesiumColor column of the input assignments dataframe. This will define the color of all arcs displayed in Cesium. See Cesium Style for the collection of available colors.

  • pathWeight (int, Optional, default as None) – Overrides the cesiumWeight column of the input assignments dataframe. This will define the weight (in pixels) of all arcs displayed in Cesium. See Cesium Style for more information.

  • pathStyle (string, Optional, default as None) – Overrides the cesiumStyle column of the input assignments dataframe. This will define the style of all arcs displayed in Cesium. See Cesium Style for available options.

  • pathOpacity (float in [0, 1], Optional, default as None) – Overrides the cesiumOpacity column of the input assignments dataframe. This will define the opacity of all arcs displayed in Cesium. See Cesium Style for more information.

Returns

Return type

N/A

Note

This function generates the following files within the directory specified by input argument problemDir:

  • [problemDir].vrv (where [problemDir] is replaced by the value of problemDir);

  • config.js

  • displayNodes.js

  • displayPath.js

  • routes.czml

Instructions for starting Cesium are provided at https://veroviz.org/documentation.html

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'))
Create Cesium output.
>>> vrv.createCesium(
...     assignments = myAssignments,
...     nodes       = myNodes,
...     startTime   = '08:00:00',
...     cesiumDir   = os.environ['CESIUMDIR'],
...     problemDir  = 'createCesium_example')