Working with GNSS data#
In this tutorial, you will learn how to calculate the Homography transform between pitch coordinates and global coordinates.
Reading GNSS data#
%load_ext autoreload
%autoreload 2
Download a GNSS data file from Kaggle#
I you have not used the KaggleDownloader, see the Dataset Preparation tutorial.
import sportslabkit as slk
dl = slk.datasets.KaggleDownloader()
path = dl.download(file_name='GNSS/G_20200220_1_0000_0030.csv', force=True)
authenticate:0172 💬| Authentication successful.
Downloading G_20200220_1_0000_0030.csv to /Users/atom/Github/SoccerTrack/sportslabkit/datasets
100%|██████████| 167k/167k [00:00<00:00, 420kB/s]
import sportslabkit
codf = slk.load_df(path, df_type='coordinates')
codf.reset_index(inplace=True, drop=True)
codf.head()
| TeamID | 0 | ... | 1 | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PlayerID | 0 | 1 | 2 | 3 | 4 | ... | 6 | 7 | 8 | 9 | 10 | ||||||||||
| Attributes | Lat | Lon | Lat | Lon | Lat | Lon | Lat | Lon | Lat | Lon | ... | Lat | Lon | Lat | Lon | Lat | Lon | Lat | Lon | Lat | Lon |
| 0 | 36.102640 | 140.107754 | 36.102705 | 140.107389 | 36.102580 | 140.107293 | 36.102643 | 140.107461 | 36.102676 | 140.107914 | ... | 36.102448 | 140.107435 | 36.102396 | 140.107551 | 36.102207 | 140.107629 | 36.102509 | 140.107602 | 36.102488 | 140.107538 |
| 1 | 36.102640 | 140.107755 | 36.102705 | 140.107390 | 36.102579 | 140.107294 | 36.102642 | 140.107461 | 36.102676 | 140.107915 | ... | 36.102448 | 140.107436 | 36.102396 | 140.107550 | 36.102207 | 140.107629 | 36.102509 | 140.107604 | 36.102488 | 140.107538 |
| 2 | 36.102640 | 140.107756 | 36.102705 | 140.107391 | 36.102579 | 140.107294 | 36.102642 | 140.107460 | 36.102676 | 140.107916 | ... | 36.102448 | 140.107437 | 36.102396 | 140.107550 | 36.102207 | 140.107629 | 36.102508 | 140.107605 | 36.102488 | 140.107538 |
| 3 | 36.102640 | 140.107757 | 36.102705 | 140.107392 | 36.102579 | 140.107294 | 36.102641 | 140.107460 | 36.102676 | 140.107916 | ... | 36.102448 | 140.107437 | 36.102397 | 140.107550 | 36.102207 | 140.107629 | 36.102508 | 140.107606 | 36.102489 | 140.107539 |
| 4 | 36.102641 | 140.107758 | 36.102705 | 140.107393 | 36.102579 | 140.107294 | 36.102640 | 140.107460 | 36.102676 | 140.107916 | ... | 36.102448 | 140.107437 | 36.102397 | 140.107551 | 36.102207 | 140.107629 | 36.102508 | 140.107607 | 36.102489 | 140.107539 |
5 rows × 44 columns
path = dl.download(file_name='gnss_keypoints.json', force=True)
codf.set_keypoints(mapping_file=path)
Downloading gnss_keypoints.json to /Users/atom/Github/SoccerTrack/sportslabkit/datasets
100%|██████████| 4.98k/4.98k [00:00<00:00, 4.34MB/s]