[Qgis-user] csv/csvt import

Even Rouault even.rouault at spatialys.com
Sat Oct 29 02:12:01 PDT 2016


Le samedi 29 octobre 2016 10:18:57, Siki Zoltan a écrit :
> Hi,
> 
> I tried to use csv/csvt files to add Delimited Text Layer.
> The widths of the fields are not considered by QGIS when saving into other
> formats. In the layer properties dialog the width and precision of fields
> are zeros after loading csv/csvt. I suppose the width and precision of
> fields should be preserved after reading of csv/csvt files.
> 
> I tested it in QGIS 2.2/2.8/2.14 but I got maximal width for fields
> (depending on the field type, character 254, float 23.15) when I save the
> file as a shapefile.
> 
> My csvt file:
> "String(20)","Real(11.2)","Real(11.2)","Real(7.2)","String(20)","String(20)
> "
> 
> My csv file:
> point_id,e,n,z,pc,pt
> 2002,650769.92,237368.68,104.560,,
> 2004,650730.28,237418.54,104.520,,
> 2005,650706.42,237412.43,104.270,,
> 2006,650707.76,237449.22,104.590,,
> 
> Is it a feature or bug?
> Any workaround?

If you open through the OGR provider (Add vector layer), this will work. Note 
that the OGR CSV driver will warn (if you do ogrinfo for example) that the 
values in the z field do not respect the Real(7.2) formatting

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com



More information about the Qgis-user mailing list