2  Getting data

GCS data was cleaned by Patricia Ternes. It was downloaded from here. However, the data was not in a friendly format (multiple .dar files sorted by frame), thus I further manipulated and transformed the data into a .csv format. Final GCS data used throughout this project can be downloaded from the releases.

In this chapter I do not demonstrate the CGS data transformation from .dat to a .csv file. Yet, the script for it (including extensive documentation) can be found in the “read_frames.R” script.

JPS produces .txt files that can be easily read into R. It did not require any pre-processing before reading it into R.

Also, both JPS and GCS datasets are transformed into sf objects to make spatial manipulation possible (and much easier!).

# trajectory data
traj1 = read.table("https://github.com/GretaTimaite/pedestrian_simulation/releases/download/data/traj.txt",
                   col.names = c("ID",  "FR",   "X",    "Y",    "Z",    "A",    "B",    "ANGLE",    "COLOR"))

traj1 |> dplyr::glimpse()

# clean GCS data

gcs = read.csv("https://github.com/GretaTimaite/pedestrian_simulation/releases/download/data/frames_final.csv")
# let's convert jps and gcs dataframes to sf objects, so we can perform spatial operations

traj1_sf = traj1 |> 
  sf::st_as_sf(coords = c("X", "Y")) |> 
  dplyr::select(-c(3,4,5,6,7)) # drop columns we won't need

gcs_sf = gcs |> 
  sf::st_as_sf(coords = c("x_coord", "y_coord")) |> 
  dplyr::mutate(geometry = geometry/14) # convert from pixels to metres