> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solvice.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Inherited Location

> Jobs without explicit locations inherit from related jobs

## Overview

Some jobs may not have explicit locations but need to inherit them from related jobs. This is useful for scenarios like:

* Pickup and delivery where delivery inherits pickup location
* Multi-stop visits where subsequent stops inherit the previous location
* Tasks that must be performed at the same location as another job

## Example Request

This example demonstrates jobs with inherited locations where Job 2 will inherit its location from Job 1.

```json theme={null}
{
  "resources": [
    {
      "id": "v1",
      "name": "Vehicle 1",
      "shifts": [
        {
          "id": "shift1",
          "start": {
            "location": {"lat": 51.1079, "lon": 17.0385},
            "time": "2024-01-01T08:00:00Z"
          },
          "end": {
            "location": {"lat": 51.1079, "lon": 17.0385},
            "time": "2024-01-01T18:00:00Z"
          },
          "capacity": [100]
        }
      ]
    }
  ],
  "jobs": [
    {
      "id": "job1",
      "name": "Job 1",
      "location": {"lat": 51.1279, "lon": 17.0485},
      "serviceDurationInSeconds": 900,
      "windows": [["2024-01-01T09:00:00Z", "2024-01-01T17:00:00Z"]],
      "load": [10]
    },
    {
      "id": "job2",
      "name": "Job 2 (Inherited Location)",
      "serviceDurationInSeconds": 600,
      "windows": [["2024-01-01T09:00:00Z", "2024-01-01T17:00:00Z"]],
      "load": [5],
      "relations": [
        {
          "type": "same_vehicle",
          "jobs": ["job1", "job2"]
        }
      ]
    }
  ]
}
```

## Key Points

1. **No Location Specified**: Job 2 has no `location` field
2. **Relation Constraint**: The `same_vehicle` relation ensures both jobs are served by the same vehicle
3. **Inherited Behavior**: When Job 2 is scheduled after Job 1, it inherits Job 1's location
4. **Travel Time**: No travel time is calculated between jobs at the same inherited location
5. **Capacity**: The `capacity` and `load` arrays must have matching dimensions

## Response Example

```json theme={null}
{
  "solution": {
    "routes": [
      {
        "resourceId": "v1",
        "shiftId": "shift1",
        "activities": [
          {
            "type": "start",
            "location": {"lat": 51.1079, "lon": 17.0385},
            "time": {
              "arrival": "2024-01-01T08:00:00Z",
              "departure": "2024-01-01T08:00:00Z"
            }
          },
          {
            "type": "job",
            "jobId": "job1",
            "location": {"lat": 51.1279, "lon": 17.0485},
            "time": {
              "arrival": "2024-01-01T08:10:00Z",
              "departure": "2024-01-01T08:25:00Z"
            },
            "travelTimeInSeconds": 600,
            "distanceInMeters": 2500
          },
          {
            "type": "job",
            "jobId": "job2",
            "location": {"lat": 51.1279, "lon": 17.0485},
            "time": {
              "arrival": "2024-01-01T08:25:00Z",
              "departure": "2024-01-01T08:35:00Z"
            },
            "travelTimeInSeconds": 0,
            "distanceInMeters": 0
          },
          {
            "type": "end",
            "location": {"lat": 51.1079, "lon": 17.0385},
            "time": {
              "arrival": "2024-01-01T08:45:00Z"
            }
          }
        ]
      }
    ]
  }
}
```

Note how Job 2 shows the same location as Job 1 and has zero travel time/distance from the previous activity.

## Use Cases

* **Service Continuity**: Multiple services at the same customer location
* **Grouped Tasks**: Tasks that must be performed together at one location
* **Dynamic Locations**: Jobs where the location depends on the execution order
