[Qgis-user] csv import issue

Telmo Nunes pinanunes at gmail.com
Sat Sep 7 07:44:41 PDT 2013


Nathan,

The csv import feature in 2.0 is a great improvement, but those "issues" I
had were in Qgis-dev (says 2.1.0-master on the About menu).
Maybe I'm doing something wrong, or might be my language settings, but
please import the attached file and check is LOC_ID field is imported as
text or numeric.
Best regards

Telmo


2013/9/7 Nathan Woodrow <madmanwoo at gmail.com>

> I would recommend using the Load Delimited Text Layer plugin (in 1.8, core
> feature in 2.0) because it will handle types automatically.
>
> - Nathan
>
>
> On Sun, Sep 8, 2013 at 12:30 AM, Telmo Nunes <pinanunes at gmail.com> wrote:
>
>> Olá Hugo,
>>
>> Thanks! csvt can solve the problem!
>> Now a question remains: Why then having the "Quote" option on the csv
>> loading dialog? Just to remove them (that would save the find/replace
>> solution from your first link) ?
>> On the "user friendly" prespective (what Qgis aims I believe) it could be
>> used to check quoted columns and create the csvt file with text for those
>> columns before loading it (or since we there, make a simple dialog to pick
>> the format for each field and create the csvt file before loading the csv).
>>
>> Creating the csvt is not an issue (for some users), but is an extra
>> "manual" processing step that I believe could be avoided.
>>
>> Anyways thanks for the tip!
>>
>> Cheers
>>
>> Telmo
>>
>>
>> 2013/9/7 Hugo <hfpmartins at gmail.com>
>>
>>> Ola Telmo,
>>>
>>> OGR supports an additional file (.csvt) to specify the types of the
>>> attribute columns of a csv file. Check these blogs:
>>>
>>> http://sigsemgrilhetas.wordpress.com/2013/05/07/visualizar-dados-dos-censos-2011-com-o-qgis/
>>>
>>> http://anitagraser.com/2011/03/07/how-to-specify-data-types-of-csv-columns-for-use-in-qgis/
>>>
>>> Cheers,
>>>
>>>
>>>
>>> On Sat, Sep 7, 2013 at 1:20 PM, Telmo Nunes <pinanunes at gmail.com> wrote:
>>>
>>>> I have a recurrent issue when loading csv files.
>>>> When one of the fields is a text field only with numeric characters
>>>> qgis allways imports that field as numeric. You might ask why would I want
>>>> a field with numeric characters to be a text field, and the answer is that
>>>> one dataset I usually use, the administrative regions regions are coded
>>>> with numeric characters as text...for example 011312 that is converted to
>>>> 11312 even if the values in the csv file have the quote markers (" or ')
>>>> and I define that on the csv import dialog (see below a csv example)
>>>>
>>>> I have found diferent workarround solutions for this issue like:
>>>>
>>>> - converting the code on the original shapefile to numeric
>>>> - importing the csv to a database and loading from the database
>>>> - creating a dummy record where i put a letter character in that field
>>>>
>>>> They all work, but is just annoying to do this over and over and adds
>>>> some unecessary steps in the data analysis workflow (for example when
>>>> importing a satscan gis file output to map the clusters). My question is:
>>>>
>>>> - Am I missing something here?
>>>> - If not, is it possible to fix that?
>>>>
>>>> Below is a portion of a csv file, if you manage to import the file and
>>>> keep the LOC_ID field as text please let me know.
>>>>
>>>>
>>>> 'ID';'LOC_ID';'CLUSTER';'P_VALUE';'CLU_OBS';'CLU_EXP';'CLU_ODE';'CLU_RISK';'LOC_OBS';'LOC_EXP';'LOC_ODE';'LOC_RISK'
>>>> 1;'070105';1,00;1,0e-17;283,00;72,06;3,92;13,44;0,00;0,00;0,00;0,00
>>>> 2;'070101';1,00;1,0e-17;283,00;72,06;3,92;13,44;0,00;2,58;0,00;0,00
>>>> 3;'070103';1,00;1,0e-17;283,00;72,06;3,92;13,44;0,00;2,72;0,00;0,00
>>>> 4;'071002';1,00;1,0e-17;283,00;72,06;3,92;13,44;47,00;3,12;15,03;17,07
>>>>
>>>> My best regards
>>>>
>>>> Telmo Nunes
>>>>
>>>> _______________________________________________
>>>> Qgis-user mailing list
>>>> Qgis-user at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>>>
>>>
>>>
>>>
>>> --
>>> Hugo Martins
>>>
>>
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130907/8df673f1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testscv.csv
Type: text/csv
Size: 1159 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20130907/8df673f1/attachment.csv>


More information about the Qgis-user mailing list