Total visit load demand as the sum of the shipment and the visit requestload_demands. The values are negative if the visit is a delivery. Demands are reported for the same types as theTransition.loads(see this field).
Extra detour time due to the shipments visited on the route before the visit and to the potential waiting time induced by time windows. If the visit is a delivery, the detour is computed from the corresponding pickup visit and is equal to:start_time(delivery) - start_time(pickup) - (duration(pickup) + travel duration from the pickup location to the delivery location).Otherwise, it is computed from the vehiclestart_locationand is equal to:start_time - vehicle_start_time - travel duration from the vehicle's `start_location` to the visit.
↳ shipment_label
string
Copy of the correspondingShipment.label, if specified in theShipment.
↳ visit_label
string
Copy of the correspondingVisitRequest.label, if specified in theVisitRequest.
Deprecated: UseTransition.vehicle_loadsinstead. Vehicle loads upon arrival at the visit location, for each type specified inVehicle.capacities,start_load_intervals,end_load_intervalsordemands. Exception: we omit loads for quantity types unconstrained by intervals and that don't have any non-zero demand on the route.
Copy of the correspondingShipment.label, if specified in theShipment.
Returns
Type
Description
string
setShipmentLabel
Copy of the correspondingShipment.label, if specified in theShipment.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getVisitLabel
Copy of the correspondingVisitRequest.label,
if specified in theVisitRequest.
Returns
Type
Description
string
setVisitLabel
Copy of the correspondingVisitRequest.label,
if specified in theVisitRequest.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getArrivalLoads
Deprecated: UseTransition.vehicle_loadsinstead. Vehicle loads upon arrival at the visit location, for each type
specified inVehicle.capacities,start_load_intervals,end_load_intervalsordemands.
Exception: we omit loads for quantity types unconstrained by intervals
and that don't have any non-zero demand on the route.
Deprecated: UseTransition.vehicle_loadsinstead. Vehicle loads upon arrival at the visit location, for each type
specified inVehicle.capacities,start_load_intervals,end_load_intervalsordemands.
Exception: we omit loads for quantity types unconstrained by intervals
and that don't have any non-zero demand on the route.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Optimization V1 Client - Class Visit (1.0.5)\n\nVersion latestkeyboard_arrow_down\n\n- [1.0.5 (latest)](/php/docs/reference/cloud-optimization/latest/V1.ShipmentRoute.Visit)\n- [1.0.4](/php/docs/reference/cloud-optimization/1.0.4/V1.ShipmentRoute.Visit)\n- [0.7.0](/php/docs/reference/cloud-optimization/0.7.0/V1.ShipmentRoute.Visit)\n- [0.6.5](/php/docs/reference/cloud-optimization/0.6.5/V1.ShipmentRoute.Visit)\n- [0.5.1](/php/docs/reference/cloud-optimization/0.5.1/V1.ShipmentRoute.Visit)\n- [0.4.0](/php/docs/reference/cloud-optimization/0.4.0/V1.ShipmentRoute.Visit)\n- [0.3.4](/php/docs/reference/cloud-optimization/0.3.4/V1.ShipmentRoute.Visit)\n- [0.2.0](/php/docs/reference/cloud-optimization/0.2.0/V1.ShipmentRoute.Visit)\n- [0.1.9](/php/docs/reference/cloud-optimization/0.1.9/V1.ShipmentRoute.Visit) \nReference documentation and code samples for the Google Cloud Optimization V1 Client class Visit.\n\nA visit performed during a route. This visit corresponds to a pickup or a\ndelivery of a `Shipment`.\n\nGenerated from protobuf message `google.cloud.optimization.v1.ShipmentRoute.Visit`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Optimization \\\\ V1 \\\\ ShipmentRoute\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getShipmentIndex\n\nIndex of the `shipments` field in the source\n[ShipmentModel](/php/docs/reference/cloud-optimization/latest/V1.ShipmentModel).\n\n### setShipmentIndex\n\nIndex of the `shipments` field in the source\n[ShipmentModel](/php/docs/reference/cloud-optimization/latest/V1.ShipmentModel).\n\n### getIsPickup\n\nIf true the visit corresponds to a pickup of a `Shipment`. Otherwise, it\ncorresponds to a delivery.\n\n### setIsPickup\n\nIf true the visit corresponds to a pickup of a `Shipment`. Otherwise, it\ncorresponds to a delivery.\n\n### getVisitRequestIndex\n\nIndex of `VisitRequest` in either the pickup or delivery field of the\n`Shipment` (see `is_pickup`).\n\n### setVisitRequestIndex\n\nIndex of `VisitRequest` in either the pickup or delivery field of the\n`Shipment` (see `is_pickup`).\n\n### getStartTime\n\nTime at which the visit starts. Note that the vehicle may arrive earlier\nthan this at the visit location. Times are consistent with the\n`ShipmentModel`.\n\n### hasStartTime\n\n### clearStartTime\n\n### setStartTime\n\nTime at which the visit starts. Note that the vehicle may arrive earlier\nthan this at the visit location. Times are consistent with the\n`ShipmentModel`.\n\n### getLoadDemands\n\nTotal visit load demand as the sum of the shipment and the visit request\n`load_demands`. The values are negative if the visit is a delivery.\n\nDemands are reported for the same types as the\n[Transition.loads](/php/docs/reference/cloud-optimization/latest/V1.ShipmentRoute.Transition)\n(see this field).\n\n### setLoadDemands\n\nTotal visit load demand as the sum of the shipment and the visit request\n`load_demands`. The values are negative if the visit is a delivery.\n\nDemands are reported for the same types as the\n[Transition.loads](/php/docs/reference/cloud-optimization/latest/V1.ShipmentRoute.Transition)\n(see this field).\n\n### getDetour\n\nExtra detour time due to the shipments visited on the route before the\nvisit and to the potential waiting time induced by time windows.\n\nIf the visit is a delivery, the detour is computed from the corresponding\npickup visit and is equal to: \n\n start_time(delivery) - start_time(pickup)\n - (duration(pickup) + travel duration from the pickup location\n to the delivery location).\n\nOtherwise, it is computed from the vehicle `start_location` and is equal\nto: \n\n start_time - vehicle_start_time - travel duration from\n the vehicle's `start_location` to the visit.\n\n### hasDetour\n\n### clearDetour\n\n### setDetour\n\nExtra detour time due to the shipments visited on the route before the\nvisit and to the potential waiting time induced by time windows.\n\nIf the visit is a delivery, the detour is computed from the corresponding\npickup visit and is equal to: \n\n start_time(delivery) - start_time(pickup)\n - (duration(pickup) + travel duration from the pickup location\n to the delivery location).\n\nOtherwise, it is computed from the vehicle `start_location` and is equal\nto: \n\n start_time - vehicle_start_time - travel duration from\n the vehicle's `start_location` to the visit.\n\n### getShipmentLabel\n\nCopy of the corresponding `Shipment.label`, if specified in the\n`Shipment`.\n\n### setShipmentLabel\n\nCopy of the corresponding `Shipment.label`, if specified in the\n`Shipment`.\n\n### getVisitLabel\n\nCopy of the corresponding\n[VisitRequest.label](/php/docs/reference/cloud-optimization/latest/V1.Shipment.VisitRequest#_Google_Cloud_Optimization_V1_Shipment_VisitRequest__getLabel__),\nif specified in the `VisitRequest`.\n\n### setVisitLabel\n\nCopy of the corresponding\n[VisitRequest.label](/php/docs/reference/cloud-optimization/latest/V1.Shipment.VisitRequest#_Google_Cloud_Optimization_V1_Shipment_VisitRequest__getLabel__),\nif specified in the `VisitRequest`.\n\n### getArrivalLoads\n\nDeprecated: Use\n[Transition.vehicle_loads](/php/docs/reference/cloud-optimization/latest/V1.ShipmentRoute.Transition#_Google_Cloud_Optimization_V1_ShipmentRoute_Transition__getVehicleLoads__)\ninstead. Vehicle loads upon arrival at the visit location, for each type\nspecified in\n[Vehicle.capacities](/php/docs/reference/cloud-optimization/latest/V1.Vehicle#_Google_Cloud_Optimization_V1_Vehicle__getCapacities__),\n`start_load_intervals`, `end_load_intervals` or `demands`.\n\nException: we omit loads for quantity types unconstrained by intervals\nand that don't have any non-zero demand on the route.\n\n### setArrivalLoads\n\nDeprecated: Use\n[Transition.vehicle_loads](/php/docs/reference/cloud-optimization/latest/V1.ShipmentRoute.Transition#_Google_Cloud_Optimization_V1_ShipmentRoute_Transition__getVehicleLoads__)\ninstead. Vehicle loads upon arrival at the visit location, for each type\nspecified in\n[Vehicle.capacities](/php/docs/reference/cloud-optimization/latest/V1.Vehicle#_Google_Cloud_Optimization_V1_Vehicle__getCapacities__),\n`start_load_intervals`, `end_load_intervals` or `demands`.\n\nException: we omit loads for quantity types unconstrained by intervals\nand that don't have any non-zero demand on the route.\n\n### getDelayBeforeStart\n\nDeprecated: Use\n[ShipmentRoute.Transition.delay_duration](/php/docs/reference/cloud-optimization/latest/V1.ShipmentRoute.Transition#_Google_Cloud_Optimization_V1_ShipmentRoute_Transition__getDelayDuration__)\ninstead. Delay occurring before the visit starts.\n\n### hasDelayBeforeStart\n\n### clearDelayBeforeStart\n\n### setDelayBeforeStart\n\nDeprecated: Use\n[ShipmentRoute.Transition.delay_duration](/php/docs/reference/cloud-optimization/latest/V1.ShipmentRoute.Transition#_Google_Cloud_Optimization_V1_ShipmentRoute_Transition__getDelayDuration__)\ninstead. Delay occurring before the visit starts.\n\n### getDemands\n\nDeprecated: Use\n[Visit.load_demands](/php/docs/reference/cloud-optimization/latest/V1.ShipmentRoute.Visit#_Google_Cloud_Optimization_V1_ShipmentRoute_Visit__getLoadDemands__)\ninstead.\n\n### setDemands\n\nDeprecated: Use\n[Visit.load_demands](/php/docs/reference/cloud-optimization/latest/V1.ShipmentRoute.Visit#_Google_Cloud_Optimization_V1_ShipmentRoute_Visit__getLoadDemands__)\ninstead."]]