> For the complete documentation index, see [llms.txt](https://docs.dbnetsoft.com/dbnetsoft/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dbnetsoft.com/dbnetsoft/raceresultexchange/scripting/examples/racemap.md).

# Racemap

Racemap makes the data of it's trackers available via an easy Web API. This URL is individual per event.&#x20;

The data in this API contains each tracker's distance to start and from finish and many other data.&#x20;

## Get Distance from start from leading vehicles

In this example, we want to fetch the distance to finish from the lead vehicle's tracker.&#x20;

First we need to setup a global list with the URL provided by Racemap and name it *Racemap*:

<figure><img src="/files/6ovmL8PO1BVeFRY9qyQO" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/1jrPZ52UfLvDhz2JNLBJ" alt=""><figcaption></figcaption></figure>

In a script, we can now access the data via the *Racemap.Data* variable. We loop through all trackers and find tghe one matching the lead vehicle tracker id. And then fetch the *toFinish* property.&#x20;

```
{{
# Define tracker ID
leadTrackerId = "66bf4318d1c783279d183e37"
leadTrackerFound = false

# Loop through all trackers and pick the one we are interested in
for tracker in Racemap.Data.starters
    if (tracker.id == leadTrackerId)
        leadTrackerFound = true
        distanceToFinish = tracker.current.toFinish
    end
end

# Show texts based on distance
if leadTrackerFound
    if distanceToFinish > 0
        "Distance to Finish: " + ((distanceToFinish / 1000) | Format "####0.0") + "km"
     else 
       "Finished"
     end
else 
    "Tracker not found"
end
}}
```
