[GIS] writeOGR column limit error: “Creating Name field failed”

exportogrqgisr

I have a SpatialPointsDataFrame with 1057 elements and 4760 columns and want to export it to a shapefile. When I try to do this with writeOGR() I get an error:

> writeOGR(pts,dsn="/home/joana/Desktop/",layer="PT", driver="ESRI Shapefile")
Error in writeOGR(pts, dsn = "/home/joana/Desktop/", layer = "PT", driver = "ESRI Shapefile") : 
  Creating Name field failed

When I reduce the column number, everything works fine.But I really need all of the columns, is there any way to work around it?

I'm using Ubuntu 12.04/R/QGIS

Best Answer

The shapefile format has some limitations due to the underlying dbase database format.

See:

http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Geoprocessing%20considerations%20for%20shapefile%20output

In your case, the limit of 10 characters field name and 255 fields total is hit.

Try some other format, like spatialite.

Or think about restructuring your database. Insert a new field called date, and store the data underneath instead of side-by-side in one column per day.