Thursday 16 February 2017

qgis - Joining New Column to DBF if OpenOffice is Giving "Longer Than Number of Digits Allowed" Error



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):


enter image description here


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:





  1. Does anybody know how to fix this so I can continue using my simple/preferred method of OpenOffice?




  2. 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)



  1. add your .csv file to project same way as a layer


  2. add your shapefile

  3. open shapefile properties (right click -> "Properties")

  4. click on "Joins" and then add join via green + button

  5. 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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...