4

How might I go about exporting a polygon shapefile (e.g. CSV) so that attributes (not geometry) are editable by others, and importing it with the changed attributes (of which there are several columns worth)?

I tried the mmqgis plugin (Transfer > Attributes Export/Join to/from CSV file), but
1) it seems to only be able to import one attribute at a time and
2) creates a separate temp.shp without geometry and
3) does not attach the new attributes to the existing polygon shapefile.

Is there something I'm doing wrong here, or do you have a better solution for my task at hand?

attributes polygon qgis

Thanks!

underdark
  • 84,148
  • 21
  • 231
  • 413
coelacanth
  • 506
  • 1
  • 6
  • 17

2 Answers2

8

the attributes of a shapefile are stored in an extra dbase-file. for example: mypolygons.shp contains geometries, mypolygons.dbf contains attributes. via an id the attributes are connected to the polygons. so just simple load your dbf file into capable software (e.g libreoffice) , edit attributes and your done

Kurt
  • 7,087
  • 4
  • 33
  • 51
  • Excellent, I opened and edited it successfully in MS Access. Thanks! – coelacanth Oct 05 '12 at 20:30
  • 7
    But be sure not to change the order of rows. Don't sort data and don't add/delete rows. You may find that Access interferes with the formatting of data, you may have more repeatable results with libreoffice. – Willy Oct 06 '12 at 11:35
6

I do this using R. There is a package called foreign which enables reading and writing of dbf files.

library(foreign) # load the package

data <- read.dbf('myfile.dbf') # read the dbf as a dataframe

In this case I just wanted to change the rounding of a column pop_den:

data$pop_den <- round(data$pop_den) # trim data (removing significant figures)

write.dbf(data, 'myfile.dbf')      # write data. This OVERWRITES your existing dbf

The caveats about re-ordering and adding/deleting rows also apply. It's hard to do these by accident in R, but you should still be careful.

djq
  • 16,297
  • 31
  • 110
  • 182