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

Agustin Lobo alobolistas at gmail.com
Mon May 17 12:08:43 CEST 2010


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

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
-- 
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeOGR-to-GPX-file-empty-table-tp5064393p5064393.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list