[R-sig-Geo] writeOGR to GPX file: empty table

Roger Bivand Roger.Bivand at nhh.no
Mon May 17 13:57:37 CEST 2010


On Mon, 17 May 2010, Agustin Lobo wrote:

>
> Roger,
> There is actually information in the file, i.e. the first point is:
>
> <?xml version="1.0"?>
> <gpx version="1.1" creator="GDAL 1.6.3"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ogr="http://osgeo.org/gdal" xmlns="http://www.topografix.com/GPX/1/1"
> xsi:schemaLocation="http://www.topografix.com/GPX/1/1
> http://www.topografix.com/GPX/1/1/gpx.xsd">
> <wpt lat="41.800745980899059" lon="2.359550956673553">
>  <extensions>
>    <ogr:Comentario>4</ogr:Comentario>
>    <ogr:Rcvr_Type>Juno ST</ogr:Rcvr_Type>
>    <ogr:GPS_Date>2009/10/27</ogr:GPS_Date>
>    <ogr:GPS_Time>03:09:11pm</ogr:GPS_Time>
>    <ogr:Datafile>AILANTO27102009.SSF</ogr:Datafile>
>    <ogr:GPS_Height>1089.392</ogr:GPS_Height>
>    <ogr:Northing>4627933.603</ogr:Northing>
>    <ogr:Easting>446791.833</ogr:Easting>
>    <ogr:PDOP_max>0</ogr:PDOP_max>
>    <ogr:HDOP_max>0</ogr:HDOP_max>
>    <ogr:Fecha_GPS>0000/00/00</ogr:Fecha_GPS>
>    <ogr:PosNofilt>0</ogr:PosNofilt>
>    <ogr:Pos_filt>0</ogr:Pos_filt>
>    <ogr:Semana_GPS>0</ogr:Semana_GPS>
>    <ogr:Segundo_GP>0</ogr:Segundo_GP>
>    <ogr:Altura_GPS>0</ogr:Altura_GPS>
>    <ogr:Prec_vert>0</ogr:Prec_vert>
>    <ogr:Prec_horz>0</ogr:Prec_horz>
>    <ogr:Dev_Tp>0</ogr:Dev_Tp>
>    <ogr:Norte>0</ogr:Norte>
>    <ogr:Este>0</ogr:Este>
>    <ogr:Abundancia>4</ogr:Abundancia>
>  </extensions>
> </wpt>
>
> Cannot read it in R. Maybe I'm not using the appropriate settings for dsn
> and layer (I've tried
> many alternatives):

The variants are as described in the readOGR help file, that is layer=
"waypoints", "tracks", "routes", "track_points", or "route_points". Maybe 
reading the help page might save time??

Roger

PS. I think that the OGR GPX driver expects a number of fields that are 
most often absent when reading (so generating NULL/NA), and may not handle 
other extra user-defined fields gracefully. If need be, create a short 
string in the NAME or name field to concatenate the data you need, that is 
work around apparent shortcomings in the driver.

>
>> writeOGR(AilantMSY09WGS84LL,
>> dsn="/media/TRANSCEND/MONTSENY2008/MONTSENY_GEODATA/FloraExotica2009/AilantMSY09R.gpx",layer="AilantMSY09R",driver="GPX",dataset_options="GPX_USE_EXTENSIONS=YES")
>
>> test <-
>> readOGR(dsn="/media/TRANSCEND/MONTSENY2008/MONTSENY_GEODATA/FloraExotica2009/AilantMSY09R.gpx",layer="AilantMSY09R")Error
>> in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
>> input_field_name_encoding) :
>  Cannot open layer
>
> Agus
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, 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