Qgis seems to change vector attribute types for certain processes. Is there a way to force preservation of the attribute types?

My situation: I have five vector layers I want to merge, all shapefiles, four of which have identical geometry and attribute types, and one whose only difference is that the geometry is Multipoint rather than Point. (The attributes are all Strings, except one which is Integer64.) I used "Vector/Geometry Tools/Multipart to singlepart" to convert the one layer, then tried using "Vector/Data Management Tools/Merge vector layers" on the four original layers and one new one.

What happened: The merge failed because the attribute data types no longer matched: the new layer had a String type for what should have been the Integer64 attribute. I fixed my attributes, ran the merge again, and this time it worked fine, except that the merge also changed the Integer64 attribute to String.

The layers I made with these processes were all temporary layers. I then tried saving to a Spatialite table, to a PostGIS table, and to a permanent (named) shapefile; the only one which preserved the attribute type was the save to a file.

Is there something wrong here, or am I missing something when I'm doing this? Other than saving to a file, how do I preserve my attribute data types?

(BTW I am using QGIS 2.18.8 on Linux Mint 17.3.)

EDIT Sample shapefiles can be found zipped here. "Test1" is the multipoint shape, with processing result in "multi2single_t1," while "test2" and "test3" are merged in "merged_t2_t3."

  • Can you provide test data? Two shapefiles, one feature per each, with one string and one Integer64 fields should be enough. – user30184 May 27 '17 at 10:43
  • Added a link to some shapefiles. – Don May 27 '17 at 16:57

Your Answer

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

Browse other questions tagged or ask your own question.