6

I have a database in txt format made of several columns of real numbers. Two column are integer, 17 are real (rounded to the first decimal) and 17 are real rounded to the second decimal.

If I import it through a txt format QGIS identified the integer columns properly, but also assign a width of 24 and a field precision of 15.

How can I limit it?

4

You should import a csv file containing your data together with a csvt file containing the type of your data. For each column of your csv the corrensponfing column of the csvt should contain the type, such as "Real","Integer", "String". You can also specify width and precision of your data includinf the following info: "Real(2.12)","Integer(3)","String(10)".

1

I am not aware of an option to limit the width and precision when importing (unless perhaps by scripting). My advice would be to create new columns using the Field Calculator, set your width/precision from there and use the name of the column you want copied into the Expression box:

Field Calculator

  • I would avoid to create new columns. I have edited the database in order to have only few decimals. Does It exist a method to avoid this excessive and unwanted field precision? I have also tried to modify the .dbf file using openoffice, but an error occurs... – Samuele Oct 30 '14 at 15:35
  • Then hopefully others can advise on how to do this while importing, I am also curious :) – Joseph Oct 30 '14 at 15:37

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.