Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to open .gdb MapSource with maptools R package gone? #63

Open
telenskyt opened this issue Mar 18, 2024 · 5 comments
Open

How to open .gdb MapSource with maptools R package gone? #63

telenskyt opened this issue Mar 18, 2024 · 5 comments

Comments

@telenskyt
Copy link

Hello. While my QGis 3.16 can perfectly open MapSource .gdb files, I am struggling to open them in R. Googling found me that I should use gpsbabel, and the first search keeps directing me to package maptools (function readGPS()), which you made obsolete though (https://r-spatial.org/r/2023/05/15/evolution4.html). But, I can't seem to open it in neither terra nor sf:

library(terra)
x1 <- vect("d:/zal/dell_NTB/tomas/gps/filipiny/orig-data/Filipiny_Petra_GPS_zal_20110427.gdb")
# Error: [vect] Cannot open this file as a SpatVector: D:\zal\dell_NTB\tomas\gps\filipiny\orig-data\Filipiny_Petra_GPS_zal_20110427.gdb

library(sf)
x1 <- st_read("d:/zal/dell_NTB/tomas/gps/filipiny/orig-data/Filipiny_Petra_GPS_zal_20110427.gdb", quiet = FALSE, drivers = "OpenFileGDB")
#Error: Cannot open "D:\zal\dell_NTB\tomas\gps\filipiny\orig-data\Filipiny_Petra_GPS_zal_20110427.gdb"; The source could be corrupt or not supported. See `st_drivers()` for a list of supported formats.
>

So, with maptools package gone, how to open Garmin MapSource .gdb file in R now?

@rsbivand
Copy link
Member

Please provide a sample file.

@rsbivand
Copy link
Member

The solution appears to be to use GPSbabel externally, converting the Garmin-specific GBD format https://www.gpsbabel.org/htmldoc-1.9.0/fmt_gdb.html to GPX https://www.gpsbabel.org/htmldoc-1.9.0/fmt_gpx.html. GPX is fully supported as a vector format by GDAL: https://gdal.org/drivers/vector/gpx.html#vector-gpx. Maybe the former maptools::readGPS could be moved to pgirmess, what fo you think, @pgiraudoux ?

@pgiraudoux
Copy link

Dear Roger,
I hope this finds you well and happy to hear from you. I am afraid that I am technically unable to maintain the function in pgirmess. In an unofficial (non-CRAN) package pgirbric, I have left a non-maintained set of function to read GPS such as readBaseCamp, readEtrex, readVista. Some of them have been in pgirmess before, and I am not even sure they still work (the GPS devices are probably no longer commercialized)...
Best,
Patrick

@rsbivand
Copy link
Member

Thanks, Patrick. So the only viable solution is for those with GPS data to convert to GPX probably using GPSbabel externally, then read using the GPX driver in GDAL through sf`` or ``terra.

@rouault
Copy link

rouault commented Oct 5, 2024

GDAL has a GPSBabel driver (https://gdal.org/en/latest/drivers/vector/gpsbabel.html) requiring the gpsbabel binary to be installed on the system. It uses internally GPX as the pivot format between GDAL and GPSBabel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants