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!

2
  • 3
    You need a unique id to match your csv to the polygon attributes (they need to match correctly)
    – Mapperz
    Commented Oct 5, 2012 at 17:38
  • "shapeid" does match in nodes.shp and attributes.csv.
    – coelacanth
    Commented Oct 5, 2012 at 20:31

2 Answers 2

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

2
  • Excellent, I opened and edited it successfully in MS Access. Thanks!
    – coelacanth
    Commented Oct 5, 2012 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
    Commented Oct 6, 2012 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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