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?

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

1 Answer 1

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
1
  • Thanks for that, helps me along in learning. I can see how this could be very useful. Jun 21, 2017 at 1:30

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.