[R-sig-Geo] reading gpx using readOGR
Roger Bivand
Roger.Bivand at nhh.no
Sun Jul 24 08:49:07 CEST 2011
On Sat, 23 Jul 2011, Roman Luštrik wrote:
> I've installed a build of GDAL from http://www.gisinternals.com/sdk/. The
> information for the build I'm using (GDAL 1.8.1, 64 bit) says that
> expat-2.0.1-VS10 has been used to compile GDAL. Still no dice.
>
> FWIW, this is the output I get when I load rgdal.
>
>> library(rgdal)
> Loading required package: sp
> Geospatial Data Abstraction Library extensions to R successfully loaded
> Loaded GDAL runtime: GDAL 1.7.2, released 2010/04/23
You have multiple installed GDAL libraries. The one found when installin
rgdal is the one you see with gdal-config --version without any extra
steps. Disambiguate your GDAL installations, or, better, install expat
(perhaps binary) then GDAL from source. Many binary builds on Linux are
badly made and confusing.
Roger
> Path to GDAL shared files:
> C:/Users/romunov/Documents/R/win-library/2.13/rgdal/gdal
> Loaded PROJ.4 runtime: Rel. 4.7.1, 23 September 2009, [PJ_VERSION: 470]
> Path to PROJ.4 shared files:
> C:/Users/romunov/Documents/R/win-library/2.13/rgdal/proj
>
>
> Cheers,
> Roman
>
>
> On Sat, Jul 23, 2011 at 7:59 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
>
>> On Sat, 23 Jul 2011, Roman Luštrik wrote:
>>
>> Thank you Roger for taking interest in this. Your time is very
>>> appreciated.
>>>
>>
>> Unfortunately, the GPX driver may be built write-only if GDAL was not built
>> with expat - the same applies to KML. This appears to be your situation. I
>> suggest upgrading your GDAL, and making sure that it is built with expat.
>>
>> Roger
>>
>>
>>> I do have a "standalone" gdal version installed (from a while back) but I
>>> think it may be "dead". I can't access ogrinfo through a command prompt
>>> (only if I run a special .bat that sets up the SDK shell) even though I
>>> have
>>> the /gdal/bin in my PATH. If I run ogrinfo in the aforementioned SDK
>>> shell,
>>> I get this output.
>>>
>>> C:\gdal>ogrinfo --formats
>>> Supported Formats:
>>> -> "ESRI Shapefile" (read/write)
>>> -> "MapInfo File" (read/write)
>>> -> "UK .NTF" (readonly)
>>> -> "SDTS" (readonly)
>>> -> "TIGER" (read/write)
>>> -> "S57" (read/write)
>>> -> "DGN" (read/write)
>>> -> "VRT" (readonly)
>>> -> "REC" (readonly)
>>> -> "Memory" (read/write)
>>> -> "BNA" (read/write)
>>> -> "CSV" (read/write)
>>> -> "NAS" (readonly)
>>> -> "GML" (read/write)
>>> * -> "GPX" (read/write)*
>>> -> "KML" (read/write)
>>> -> "GeoJSON" (read/write)
>>> -> "GMT" (read/write)
>>> -> "SQLite" (read/write)
>>> -> "ODBC" (read/write)
>>> -> "PGeo" (readonly)
>>> -> "MSSQLSpatial" (read/write)
>>> -> "PostgreSQL" (read/write)
>>> -> "MySQL" (read/write)
>>> -> "PCIDSK" (read/write)
>>> -> "XPlane" (readonly)
>>> -> "AVCBin" (readonly)
>>> -> "AVCE00" (readonly)
>>> -> "DXF" (read/write)
>>> -> "Geoconcept" (read/write)
>>> -> "GeoRSS" (read/write)
>>> -> "GPSTrackMaker" (read/write)
>>> -> "VFK" (readonly)
>>> -> "PGDump" (read/write)
>>> -> "GPSBabel" (read/write)
>>> -> "SUA" (readonly)
>>> -> "OpenAir" (readonly)
>>> -> "PDS" (readonly)
>>> -> "WFS" (readonly)
>>> -> "HTF" (readonly)
>>> -> "AeronavFAA" (readonly)
>>>
>>> ogrDrivers() gives out this:
>>>
>>> ogrDrivers()
>>>>
>>> name write
>>> 1 AVCBin FALSE
>>> 2 AVCE00 FALSE
>>> 3 BNA TRUE
>>> 4 CSV TRUE
>>> 5 DGN TRUE
>>> 6 DXF TRUE
>>> 7 ESRI Shapefile TRUE
>>> 8 Geoconcept TRUE
>>> 9 GeoJSON TRUE
>>> 10 GeoRSS TRUE
>>> 11 GML TRUE
>>> 12 GMT TRUE
>>> 13 GPSTrackMaker TRUE
>>> *14 GPX TRUE*
>>> 15 KML TRUE
>>> 16 MapInfo File TRUE
>>> 17 Memory TRUE
>>> 18 PCIDSK FALSE
>>> 19 REC FALSE
>>> 20 S57 TRUE
>>> 21 SDTS FALSE
>>> 22 TIGER TRUE
>>> 23 UK .NTF FALSE
>>> 24 VFK FALSE
>>> 25 VRT FALSE
>>> 26 XPlane FALSE
>>>
>>> Cheers,
>>> Roman
>>>
>>>
>>>
>>> On Sat, Jul 23, 2011 at 10:51 AM, Roger Bivand <Roger.Bivand at nhh.no>
>>> wrote:
>>>
>>> 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<https://stat.ethz.ch/mailman/**listinfo/r-sig-geo>
>>>>> <https://**stat.ethz.ch/mailman/listinfo/**r-sig-geo<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
>>>>
>>>>
>>>
>>>
>>>
>>>
>> --
>> 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
>>
>
>
>
>
--
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