[R-sig-Geo] problem writing GML file
b.rowlingson at lancaster.ac.uk
Sun Feb 21 22:49:50 CET 2010
On Sun, Feb 21, 2010 at 9:28 PM, Michael Denslow
<michael.denslow at gmail.com> wrote:
> Dear r-sig-geo,
> I was able to make a SpatialPointsDataFrame just fine with the
> following commands.
>> coordinates(floras) = c('long.cent.W','lat.cent.N')
>  "SpatialPointsDataFrame"
>  "sp"
> but when I run writeOGR, I get an error
>> writeOGR(floras,paste(getwd(),'florasTEST.gml',sep='/'),'floras', driver = 'GML')
> Error in writeOGR(floras, paste(getwd(), "florasTEST.gml", sep = "/"), :
> unknown data type
That's weird - writeOGR looks like it should output the type and class
of the column when it gets this problem:
else stop(paste(dfcls[i], dftof[i], "unknown data type"))
- unless you're on a different version. Try running writeOGR in debug
mode - do:
then run your writeOGR function call. Hit return to step a line at a
time, and inspect variables. Or how about cutting some of your
variables out and seeing what fixes it/breaks it?
your sp object only seemed to have factors, numbers, and logicals and
so writeOGR shouldnt have any problem with it...
More information about the R-sig-Geo