In QGIS the attribute table of an imported CSV has some field headers with more than 9 digits. In a derived shapefile, field headers, where source header is more than 9 digits, get truncated. Because the headers are different when the source is updated the fields in the shapefile with truncated headers are not populated (they are null). Is there a recommended way to deal with this?

  • 1
    Is shortening the CSV field names an option? – underdark Jun 10 '17 at 19:53
  • 1
    Are you bound to use shapefiles? Other file fomats don't have that restriction. – AndreJ Jun 11 '17 at 6:11
  • underdark - yes, probably what I should have done. – Paul Ransom Jun 21 '17 at 1:22

Even though you did not tag GRASS in your question, I would point out that the module for importing a csv file to GRASS allows for defining new column names. So you could import the CSV, changing the column names, then export to shape.

Suppose the file data.csv looks something like:

2,"more text",43.2

Then in GRASS:

v.in.ascii input=data.csv output=data columns="id integer, name text, val double" separator=comma
v.out.ogr input=data output=data.shp
  • Thanks for that, helps me along in learning. I can see how this could be very useful. – Paul Ransom Jun 21 '17 at 1:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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