3

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
2

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:

long_column_1,long_column_2,another_long_column
1,"text",345.0
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
|improve this answer|||||
  • 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.