Skip to content

Problem with writeOGR()

2 messages · Agustin Lobo, Michael Sumner

#
I'm puzzled with this:

 > class(gpsori1)
[1] "SpatialPointsDataFrame"
attr(,"package")
[1] "sp"
 > writeOGR(gpsori1, dsn="CAST20090907", 
layer="CAST20090907gps1",driver="ESRI Shapefile")
Error in writeOGR(gpsori1, dsn = "CAST20090907", layer = 
"CAST20090907gps1",  :
  unknown data type

Am I doing something wrong or is there a recent change that I'm not 
aware of?

Thanks

Agus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: alobolistas.vcf
Type: text/x-vcard
Size: 251 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20091104/3bc59930/attachment.vcf>
#
Hi Agustin, you will need to determine which columns in the data frame
are causing problems.

Can you run this and let us know what you see?

summary(gpsori1)

For example, you cannot write POSIXct columns to SHP and would need to
convert to text, or numeri:

library(rgdal)
d <- data.frame(x = 1:10, y = 1:10, z = 1:10)
coordinates(d) <- ~x+y

## OK
writeOGR(d, ".", "test", "ESRI Shapefile")
unlink("test.shp")

d$z <- Sys.time() + 1:10
## not OK
writeOGR(d, ".", "test", "ESRI Shapefile")


Regards, Mike.
On Thu, Nov 5, 2009 at 7:11 AM, Agustin Lobo <alobolistas at gmail.com> wrote: