[R-sig-Geo] reading gpx using readOGR

Roger Bivand Roger.Bivand at nhh.no
Sat Jul 23 10:51:45 CEST 2011


On Sat, 23 Jul 2011, Roman Luštrik wrote:

> Dear list,
>
> I'm trying to read a gpx file using rgdal::readOGR function. I get the
> following error, as demonstrated by using the example from the help file of
> readOGR.

You have installed GDAL yourself. What does ogrinfo --formats or 
ogrDrivers() show? Do you have a GDAL built with expat to include the GPX 
driver?

Roger

>
> dsn <- system.file("vectors/test_trk2.gpx", package = "rgdal")[1]
> dsn
>  [1]
> "C:/Users/romunov/Documents/R/win-library/2.13/rgdal/vectors/test_trk2.gpx"
> test_trk2 <- try(readOGR(dsn=dsn, layer="tracks"))
>  Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
> input_field_name_encoding) :
>    Cannot open file
>
>
> I've traced the ogrInfo and it stops at the line where it makes a .Call to
> "ogrInfo" function.
>
> debug: ogrinfo <- .Call("ogrInfo", as.character(dsn), as.character(layer),
>    PACKAGE = "rgdal")
> Browse[3]> n
> Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
> input_field_name_encoding) :
>  Cannot open file
>
>
> What am I missing?
>
> Here's my sessionInfo.
>
>> sessionInfo()
> R version 2.13.1 (2011-07-08)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
> locale:
> [1] LC_COLLATE=Slovenian_Slovenia.1250  LC_CTYPE=Slovenian_Slovenia.1250
> [3] LC_MONETARY=Slovenian_Slovenia.1250 LC_NUMERIC=C
> [5] LC_TIME=Slovenian_Slovenia.1250
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> other attached packages:
> [1] rgdal_0.7-1 sp_0.9-79
> loaded via a namespace (and not attached):
> [1] grid_2.13.1     lattice_0.19-30 tools_2.13.1
>
>
> Any tips on how to solve this will be much appreciated.
>
>
> Cheers,
> Roman
>
>
>
>   --
> In God we trust, all others bring data.
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list