When I need to add a data column to a DBF, I always download the shapefile, open the DBF with OpenOffice for Mac, us a VLOOKUP( ) to add my data to a new column, re-save the file as a DBF, then open in in QGIS and that's never not worked for me.
When I do that now, I'm getting an error. I'm using this TIGER/Line Shapefile of Pennsylvania zip codes (.zip), which works fine if I put it right into QGIS and start working with it -- then I add the new column of data, but the second I try to re-save in OpenOffice, it gives me this error (regardless of whether I add the column or not):
The cell it's referring to is simply "108807," so I can't reduce the decimal points that aren't there. I tried re-copying and pasting as values and it didn't fix it either.
So my two questions are:
Does anybody know how to fix this so I can continue using my simple/preferred method of OpenOffice?
Or can anybody direct me to another way to join the new column I need onto this DBF if it's currently a csv file that can be matched with a unique identifier on the original DBF? (I read something on here earlier about being able to do this with R, but I couldn't figure it out.)
Answer
You can join .csv file to your shapefile attribute table by (as you wrote) matching unique identier (ID or something else)
- add your .csv file to project same way as a layer
- add your shapefile
- open shapefile properties (right click -> "Properties")
- click on "Joins" and then add join via green + button
- as a layer select your csv file, in join and target field select unique identifier (for examplle ID)
if you need you can export the shapefille with joined attributes in table by right clicing -> "Save As...". hope this helps you
No comments:
Post a Comment