Hi Philip

As has been pointed out the problem is that the "numbers" in your file are not 
numbers, as the have a '%' character included.  The delimited text reader only 
handles things that look like numbers, and at the moment things like '5%' don't 
come into that category (this could be changed but at the moment it isn't built 
to recognize the percentage sign as part of a number).  So it reads these 
fields a text string fields.

In the case of your file though there is a workaround, which is to treat the 
percentage as part of the delimiter, and to use a regular expression to define 
the delimiter.  The attached screenshot shows the settings that you can use to 
read the file.  The important things to notice are the use of a regular 
expression as a delimiter and the expression used [\%\,]+, which translates as 
"any string of consecutive percentage signs or commas".

I'd agree that this is not even slightly obvious, but it does work!

Cheers
Chris

________________________________________
From: Qgis-user [qgis-user-boun...@lists.osgeo.org] On Behalf Of Phillip Money 
[phillip.mo...@hotmail.com]
Sent: 16 July 2016 01:03
To: Werner Macho
Cc: qgis-community
Subject: Re: [Qgis-user] Importing CSV files

Thanks Werner and Richard for your help so far. I will have to pursue this 
tomorrow as it is late here in Australia.

I will respond tomorrow.

Phillip


________________________________
From: werner.ma...@gmail.com
Date: Fri, 15 Jul 2016 14:53:03 +0200
Subject: Re: [Qgis-user] Importing CSV files
To: phillip.mo...@hotmail.com
CC: richard.mcdonn...@opw.ie; qgis-user@lists.osgeo.org

Find attached the working csv and csvt file - And remember - this csv is now 
NOT to be loaded with delimited text but rather as a "normal" vector layer.

regards
Werner

On Fri, Jul 15, 2016 at 2:26 PM, Phillip Money 
<phillip.mo...@hotmail.com<mailto:phillip.mo...@hotmail.com>> wrote:
Richard and Werner.

I left the csvt file as "String", "Integer", "Integer", "Integer". I converted 
the percentages to numbers. It still didn't work. At Richard's suggestion, I 
converted the csv file to a text file and it worked. I can't understand why it 
didn't work with a CSV file. I am using QGIS Nodego. Thanks for your help, but 
I am still stumped about the csv file.

Phillip


________________________________
From: werner.ma...@gmail.com<mailto:werner.ma...@gmail.com>
Date: Fri, 15 Jul 2016 14:17:35 +0200
Subject: Re: [Qgis-user] Importing CSV files
To: richard.mcdonn...@opw.ie<mailto:richard.mcdonn...@opw.ie>
CC: phillip.mo...@hotmail.com<mailto:phillip.mo...@hotmail.com>; 
qgis-user@lists.osgeo.org<mailto:qgis-user@lists.osgeo.org>


Hi Richard,

Surely QGIS is able to import it - but you forgot about that sentence in his 
first post:
"I have set up a csvt file with "String", "Integer", "Integer", "Integer" "

Using a csvt is sometimes very handy - but as already written "86%" is 
unfortunately no integer ;)

regards
Werner


On Fri, Jul 15, 2016 at 2:14 PM, Richard McDonnell 
<richard.mcdonn...@opw.ie<mailto:richard.mcdonn...@opw.ie>> wrote:
Phillip,
I have copied out what you sent, paste it into notepad and saved it as a txt 
file. I then imported it into QGIS using Add delimited Text Layer, making sure 
to select Custom delimiters, and selecting Semicolon.
One other thing I done was select No geometry.
This has worked perfectly see attribute table below

[cid:part1.00080202.07000508@opw.ie]

I hope the above settings work, I am running QGIS 2.14 by the way, shouldn't 
make a difference though.
Regards,

Richard.

On 15/07/2016 13:03, Phillip Money wrote:
Richard,

I am using Add delimited Text Layer.

Here is a snippet of the data.

LGA_NAME;Non-Indigenous;Aboriginal;Torres Strait Islander
Albury (C);93%;2%;0%
Armidale Dumaresq (A);88%;6%;0%
Ashfield (A);93%;1%;0%
Auburn (C);93%;1%;0%
Ballina (A);93%;3%;0%
Balranald (A);87%;6%;0%
Bankstown (C);94%;1%;0%
Bathurst Regional (A);91%;4%;0%

I had the data separated by commas, but changed it to semi-colons. Neither 
worked. I also change the date to numerical format as in .93. That didn't work 
either.

On 15 July 2016 at 22:00, Richard McDonnell 
<richard.mcdonn...@opw.ie<mailto:richard.mcdonn...@opw.ie>> wrote:
Phillip,
Can you supply a sample of the data, also what version are you running of QGIS.
The other thing is are you using Add delimited Text Layer or are you just 
loading the CSV directly?
Regards,

Richard.


On 15/07/2016 12:29, Phillip Money wrote:
I have a CSV file with four columns. The first column is text, and the 
succeeding columns are percentages. I have set up a csvt file with "String", 
"Integer", "Integer", "Integer" When I import the file into QGIS as a delimited 
text layer, QGIS strips out all the percentages. They come in as null values. I 
have tried a lot of things, but can't get past this.


For example, I have tried converting the percentages to numbers and bringing 
them in that way; same thing happens.


I would appreciate any help.


Regards


Phillip Money





_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org<mailto:Qgis-user@lists.osgeo.org>
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

--
Richard McDonnell
GIS Specialist PgD GIS AssocSCSI
OPW FRM Data Management
52 Stephens Green, Dublin 2.
TEL: 01 6476543
OPW - Ag féachaint don am atá le teacht - Ag caomhnú ón am atá thart
OPW - Looking to the future - Caring for the past
[http://www.opw.ie/en/media/opw-email-banner.png]<http://www.opw.ie/>
Email Disclaimer: http://www.opw.ie/en/disclaimer/


--
Richard McDonnell
GIS Specialist PgD GIS AssocSCSI
OPW FRM Data Management
52 Stephens Green, Dublin 2.
TEL: 01 6476543

_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org<mailto:Qgis-user@lists.osgeo.org>
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user



This message contains information, which may be in confidence and may be 
subject to legal privilege. If you are not the intended recipient, you must not 
peruse, use, disseminate, distribute or copy this message. If you have received 
this message in error, please notify us immediately (Phone 0800 665 463 or 
i...@linz.govt.nz) and destroy the original message. LINZ accepts no 
responsibility for changes to this email, or for any attachments, after its 
transmission from LINZ. Thank You.
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to