> For the complete documentation index, see [llms.txt](https://docs.fractalworks.io/joule/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fractalworks.io/joule/use-case-examples/telco/location-tracking.md).

# Location tracking

***

This use case demonstrates geospatial location alerting using mobile location data and user defined geofences. When a mobile enters a geofence zone a tracking trigger is generated and tracked until the user exits the geofence. Three tracking states are generated per entity; Entered, dwelling and exitted. Geofences are manually defined within the configuration file.

## Use case configuration

*File: app-geotrackedDevices.env*

```bash
SOURCEFILE=conf/sources/mobileSimulatedStream.yaml
ENGINEFILE=conf/usecases/analytics/mobileEventGeoTrackingAndAlertingStream.yaml
PUBLISHFILE=conf/publishers/anonymisedGeoTrackedMobileEventFile.yaml
```

## Pipeline **configuration**

This pipeline will add tracking geofence Ids, using defined geofences, to an event once a device as entered.&#x20;

```yaml
processing unit:
  pipeline:
    - filter:
        expression: "(imsi !== null ) ? true : false;"
    
    - entity geo tracker:
        name: imsiTracker
        entity key: imsi
        min dwelling time: 5
        timeUnit: SECONDS  
        geofences:
          -
            id: 1000
            coordinates: ["51.4623328","-0.1759467"]
            radius: 150
          -
            id: 2000
            coordinates: ["51.5136287","-0.1137969"]
            radius: 150
          -
            id: 3000
            coordinates: ["51.51359909390081","-0.10022502910787918"]
            radius: 150
            
          - id: 4000
            coordinates: [ "51.51376937553133","-0.10087411403509025" ]
            radius: 150
      
          - id: 5000
            coordinates: [ "51.5139730193047","-0.1035375532265023" ]
            radius: 150
            
          - id: 6000
            coordinates: [ "51.51436695471256","-0.10715183002670553" ]
            radius: 150
      
          - id: 7000
            coordinates: [ "51.51375264191751","-0.11159351772462783" ]
            radius: 150
```

### Output Event

The following fields are added to the processed StreamEvent object.

```
Key: geoTrackingInfo 
Value: GeoTrackingInfo
          - trackingTag
          - currentSpeedAndDirection
          - previousSpeedAndDirection
          - distanceTraveled
          - previousDistanceTraveled
          - previousLat
          - previousLng
          - currentLat
          - currentLng
          - geoFenceOccupancyState
          - previousUpdatedTimestamp
          - currentUpdatedTimestamp
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fractalworks.io/joule/use-case-examples/telco/location-tracking.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
