9
$\begingroup$

I use a mobile recording platform (drifting recorders) where GPS data is collected in an independent data stream and saved as a csv file. I analyze my data in PAMGuard, and would like to integrate this GPS data directly into my PAMGuard database.

Is there a streamlined way to integrate archival, externally collected GPS data into PAMGuard?

$\endgroup$

2 Answers 2

8
$\begingroup$

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

$\endgroup$
5
$\begingroup$

PAMGuard is a bit fussy about the format of it's database tables, so I'd recommend getting PAMGuard to create a blank database table for you (add a GPS module and this will happen automatically). Then you'll need to either import data into the table, or write some code to insert data into that table. This could be done in any programming language that can connect to a CSV file and to a database - which is just about any programming language you can imagine, e.g. Matlab, R, Python, C, etc.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.