[R-sig-Geo] writeOGR to GPX file: empty table
Roger Bivand
Roger.Bivand at nhh.no
Mon May 17 13:19:18 CEST 2010
On Mon, 17 May 2010, Agustin Lobo wrote:
>
> Hi!,
>
> I'm converting from shape to gpx through rgdal (I get an empty file with
> gpsbabel and, according to its web, I'm not convinced that the shape format
> is actually fully supported by gpsbabel).
>
> This is what I do:
>> AilantMSY09 <-
>> readOGR(dsn="/media/TRANSCEND/MONTSENY2008/MONTSENY_GEODATA/FloraExotica2009/AilantMSY09/",layer="AilantMSY09")
> OGR data source with driver: ESRI Shapefile
>
>> writeOGR(AilantMSY09,
>> dsn="/media/TRANSCEND/MONTSENY2008/MONTSENY_GEODATA/FloraExotica2009/AilantMSY09GPX",layer="AilantMSY09GPX",driver="GPX")
> Error in writeOGR(AilantMSY09, dsn =
> "/media/TRANSCEND/MONTSENY2008/MONTSENY_GEODATA/FloraExotica2009/AilantMSY09GPX",
> :
>
> GDAL Error 6: Field of name 'Comentario' is not supported in GPX schema.
> Use GPX_USE_EXTENSIONS creation option to allow use of the <extensions>
> element.
>
> After reading the gdal-ogr doc, I include dataset_options:
>
>> writeOGR(AilantMSY09,
>> dsn="/media/TRANSCEND/MONTSENY2008/MONTSENY_GEODATA/FloraExotica2009/AilantMSY09GPX",layer="AilantMSY09GPX",driver="GPX",dataset_options="GPX_USE_EXTENSIONS=YES")
> Error in writeOGR(AilantMSY09, dsn =
> "/media/TRANSCEND/MONTSENY2008/MONTSENY_GEODATA/FloraExotica2009/AilantMSY09GPX",
> :
>
> GDAL Error 1: Latitude 4627933.603181 is invalid. Valid range is [-90,90].
> This warning will not be issued any more
>
> Which indicates that the user must unproject first (it seems that GPX files
> only support lon,lat):
>
>> AilantMSY09WGS84LL <- spTransform(AilantMSY09, CRS("+proj=longlat
>> +ellps=WGS84"))
> Warning message:
> In spTransform(xSP, CRSobj) :
> Only x- and y-coordinates are being transformed
>
>> writeOGR(AilantMSY09WGS84LL,
>> dsn="/media/TRANSCEND/MONTSENY2008/MONTSENY_GEODATA/FloraExotica2009/AilantMSY09GPX.gpx",layer="AilantMSY09GPX",driver="GPX",dataset_options="GPX_USE_EXTENSIONS=YES")
>
> Once in QGIS, the points are in the right sites but the attribute table is
> all NULLs
Please check the output GPX file in a text editor to see what is present
there. Also please read the GPX file back into R with readOGR(), assuming
that on your platform the OGR GPX driver has read support.
Roger
>
> This is not a concern (by now) for me as I just need the gpx file to upload
> the points to the gps unit,
> but report it just in case this is a bug and/or to know if I'm doing
> something wrong.
>
> Note: I do get the correct table for the gpx file using plugin OGR converter
> in QGIS.
>
> Thanks
>
> 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