With R you can use the addPgGps
function from the PAMmisc
package. The only requirement is that your CSV file has columns named UTC
, Latitude
, and Longitude
. If your times are not in UTC timezone then you can either convert them to UTC yourself, or provide the timezone your times are in with the tz
argument (see OlsonNames()
for a list of valid specifications) and the function will convert it for you before adding to the database. By default this tries date formats MM/DD/YYYY HH:MM:SS, MM-DD-YYYY HH:MM:SS, YYYY/MM/DD HH:MM:SS, and YYYY-MM-DD HH:MM:SS, so if your datetime format is different you will need to specify that with the format
arugment. This will add these to your database as a table named gpsData
and adds the same columns that PAMGuard would normally have for the GPS table. However, I'm not sure if PAMGuard is able to use these data for things like localization or showing the map.
# PAMGuard database
db <- 'PamguardDb.sqlite3'
# CSV of GPS data
gps <- 'GPSData.csv'
library(PAMmisc)
addPgGps(db=db, gps=gps, source='csv')
# Example if your times are off California coast
addPgGps(db=db, gps=gps, source='csv', tz='America/Los_Angeles')
# Or example if you have dates in DD-MM-YYYY HH:MM:SS format
addPgGps(db=db, gps=gps, source='csv', format='%d-%m-%Y %H:%M:%S')
Again, there is no guarantee that this will work with PAMGuard functionality that requires GPS data (although if there is enough interest I can try to work with the PAMGuard developers to make this happen). But it does mean that you have one less file to carry around since all that GPS data will live in the database, and if you use the PAMpal
package for analysing your data it can easily access GPS data from your database and pair them to your detections:
https://taikisan21.github.io/PAMpal/NextStepsProcessing.html#adding-gps-data