Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm currently using the following script to add some attribute data from a table to lots of individual shapefiles:

library(rgdal)
specieslist <- read.csv("SpeciesList1.txt", header=F)
attdata <- read.table("TestAtt.csv", sep = ",", header=T)
for (n in 1:dim(specieslist)[1]) 
{
speciesname <- specieslist[n,1]
shp <- readOGR("Mesoamerica_modified_polygons", speciesname)
shp$ENGL_NAME<-attdata[n,2]
writeOGR(shp, "PolygonsV2", speciesname, driver="ESRI Shapefile")
}

I get the following warning(s) at the end:

1: In writeOGR(shp, "PolygonsV2", speciesname, driver = "ESRI Shapefile") :
Field names abbreviated for ESRI Shapefile driver

When viewing the attribute table of the shapefiles after this process, the Field name has been shortened to 'ENGL_', but I want it to stay as 'ENGL_NAME'. Is there a way to turn this abbreviating off?

Any help much appreciated.

share|improve this question
    
Are any of the fieldnames in the shapefile > 10 characters? Looks like a bug in the R bindings to me. –  geographika Aug 2 '12 at 12:04
1  
Hi there, I just re-ran the script and now it isn't abbreviating. I'm not sure what's changed to cause this though... –  JPD Aug 2 '12 at 12:27
add comment

1 Answer

up vote 1 down vote accepted

You can't, it's a shapefile issue. See http://gdal.org/ogr/drv_shapefile.html under 'Creation Options'

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.