[GRASS-user] Import Point from *.csv Problem

,

Hello,

I try to import Points from a comma separated file in GRASS 6.4.2SVN on
my Mac OS X but somehow I fail...

The original file is a 3-column Excelsheet (ID,X,Y). I saved that sheet as a *csv in my Excel 2011 on Mac OS X and then I try to import it. I follow the steps in this video (exept that I am working on Mac):http://www.youtube.com/watch?v=JgQBPoJeeLY

(Tue Jan 24 11:05:42 2012)
v.in.ascii input=/Users/.../InputForGRASS.csv output=Stations fs=; skip=1 x=2 y=3
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 2
Minimum number of columns: 2
ERROR: y column number > minimum last column number
(incorrect field separator?)
(Tue Jan 24 11:05:42 2012) Command finished (0 sec)

So I opened the file with textwrangler to check it. I changed the line endings from the original mac endings(CR) to Unix style (LF) and saved the file again, but I get the same error. I don't know what I am doing wrong.
Even if I copy and paste the coordinates from the text file into the dialog I get the error. I also tried it with G6.5SVN (some weeks old)

I attached the original *.csv file so maybe someone of you can tell me what is wrong with my import.

Thanks for your help in advance.

/johannes
--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

(attachments)

InputForGRASS.csv (2.17 KB)

Hi Johannes,
i guess your csv file uses funny characters for spaces and new lines
and grass can not handle them.
I have attached a screenshot showing the file opened in vim using ubuntu linux.

Best regards
Soeren

2012/1/24 Johannes Radinger <JRadinger@gmx.at>:

Hello,

I try to import Points from a comma separated file in GRASS 6.4.2SVN on
my Mac OS X but somehow I fail...

The original file is a 3-column Excelsheet (ID,X,Y). I saved that sheet as a *csv in my Excel 2011 on Mac OS X and then I try to import it. I follow the steps in this video (exept that I am working on Mac):http://www.youtube.com/watch?v=JgQBPoJeeLY

(Tue Jan 24 11:05:42 2012)
v.in.ascii input=/Users/.../InputForGRASS.csv output=Stations fs=; skip=1 x=2 y=3
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 2
Minimum number of columns: 2
ERROR: y column number > minimum last column number
(incorrect field separator?)
(Tue Jan 24 11:05:42 2012) Command finished (0 sec)

So I opened the file with textwrangler to check it. I changed the line endings from the original mac endings(CR) to Unix style (LF) and saved the file again, but I get the same error. I don't know what I am doing wrong.
Even if I copy and paste the coordinates from the text file into the dialog I get the error. I also tried it with G6.5SVN (some weeks old)

I attached the original *.csv file so maybe someone of you can tell me what is wrong with my import.

Thanks for your help in advance.

/johannes
--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

(attachments)

fancy_csv_file.png

On Tue, Jan 24, 2012 at 11:16 AM, Johannes Radinger <JRadinger@gmx.at> wrote:

Hello,

I try to import Points from a comma separated file in GRASS 6.4.2SVN on
my Mac OS X but somehow I fail...

The original file is a 3-column Excelsheet (ID,X,Y). I saved that sheet as a *csv in my Excel 2011 on Mac OS X and then I try to import it. I follow the steps in this video (exept that I am working on Mac):http://www.youtube.com/watch?v=JgQBPoJeeLY

(Tue Jan 24 11:05:42 2012)
v.in.ascii input=/Users/.../InputForGRASS.csv output=Stations fs=; skip=1 x=2 y=3

Try this
... fs=";" ...

Probably the shell is interfering with an unprotected semicolon.

Markus

2012/1/24 Sören Gebbert <soerengebbert@googlemail.com>:

Hi Johannes,
i guess your csv file uses funny characters for spaces and new lines
and grass can not handle them.

dos2unix may be used to polish the file.

Markus

I would try formatting the numbers without any spaces (it looks like Excel is putting spaces where there might be commas separating the thousands), and saving (as you’ve tried) with UNIX rather than Mac line breaks. you could then replace the semicolons with commas for a regular comma-separated-values file, or you could specify the field separator as Markus suggests (“fs=”;").

Nick Cahill

On Jan 24, 2012, at 4:16 AM, Johannes Radinger wrote:

<InputForGRASS.csv>

Hello,

your input file contains four (columns 2 and 3, line positions 9,13,19,23)
ascii = zero characters (show up in BBEDIT-text-view- show invisibles).

I removed these, and replaced ; with tab - ran this (using fs=tab but fs=,
also works, not fs=;):

GRASS 6.4.2svn (nc_spm_07):~ > v.in.ascii input=InputForGRASS_rev.csv
out=test skip=1 fs=tab col='x integer, y integer, z integer'
Scanning input for column types...
Maximum input row length: 23
Maximum number of columns: 3
Minimum number of columns: 3
Column: 1 type: integer
Column: 2 type: integer
Column: 3 type: integer
Importing points...
100%
Populating table...
Building topology for vector map <test>...
Registering primitives...
80 primitives registered
80 vertices registered
Building areas...
100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
100%
Number of nodes: 80
Number of primitives: 80
Number of points: 80
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
v.in.ascii complete.
GRASS 6.4.2svn (nc_spm_07):~ >

I attach the revised input file.

Jon

Hello,

I try to import Points from a comma separated file in GRASS 6.4.2SVN on
my Mac OS X but somehow I fail...

The original file is a 3-column Excelsheet (ID,X,Y). I saved that sheet as
a *csv in my Excel 2011 on Mac OS X and then I try to import it. I follow
the steps in this video (exept that I am working on
Mac):http://www.youtube.com/watch?v=JgQBPoJeeLY

(Tue Jan 24 11:05:42 2012)
v.in.ascii input=/Users/.../InputForGRASS.csv output=Stations fs=; skip=1
x=2 y=3
Scanning input for column types...
Maximum input row length: 31
Maximum number of columns: 2
Minimum number of columns: 2
ERROR: y column number > minimum last column number
(incorrect field separator?)
(Tue Jan 24 11:05:42 2012) Command finished (0 sec)

So I opened the file with textwrangler to check it. I changed the line
endings from the original mac endings(CR) to Unix style (LF) and saved the
file again, but I get the same error. I don't know what I am doing wrong.
Even if I copy and paste the coordinates from the text file into the
dialog I get the error. I also tried it with G6.5SVN (some weeks old)

I attached the original *.csv file so maybe someone of you can tell me
what is wrong with my import.

Thanks for your help in advance.

/johannes
--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

(attachments)

InputForGRASS_rev.csv (1.93 KB)

Thank you for your help!

it seems that excel somehow doesn't manage to produce universal and platform independent csv's (at least not excel 2011 on Mac). Anyway I just imported the execel into R and exported it to csv. The import worked now perfectly useing fs=",".

/johannes

-------- Original-Nachricht --------

Datum: Tue, 24 Jan 2012 12:04:05 -0000 (GMT)
Von: "Jón Eiríksson" <jeir@hi.is>
An: "Johannes Radinger" <JRadinger@gmx.at>
CC: "GRASS user list" <grass-user@lists.osgeo.org>
Betreff: Re: [GRASS-user] Import Point from *.csv Problem

Hello,

your input file contains four (columns 2 and 3, line positions 9,13,19,23)
ascii = zero characters (show up in BBEDIT-text-view- show invisibles).

I removed these, and replaced ; with tab - ran this (using fs=tab but fs=,
also works, not fs=;):

GRASS 6.4.2svn (nc_spm_07):~ > v.in.ascii input=InputForGRASS_rev.csv
out=test skip=1 fs=tab col='x integer, y integer, z integer'
Scanning input for column types...
Maximum input row length: 23
Maximum number of columns: 3
Minimum number of columns: 3
Column: 1 type: integer
Column: 2 type: integer
Column: 3 type: integer
Importing points...
100%
Populating table...
Building topology for vector map <test>...
Registering primitives...
80 primitives registered
80 vertices registered
Building areas...
100%
0 areas built
0 isles built
Attaching islands...
Attaching centroids...
100%
Number of nodes: 80
Number of primitives: 80
Number of points: 80
Number of lines: 0
Number of boundaries: 0
Number of centroids: 0
Number of areas: 0
Number of isles: 0
v.in.ascii complete.
GRASS 6.4.2svn (nc_spm_07):~ >

I attach the revised input file.

Jon

> Hello,
>
> I try to import Points from a comma separated file in GRASS 6.4.2SVN on
> my Mac OS X but somehow I fail...
>
> The original file is a 3-column Excelsheet (ID,X,Y). I saved that sheet
as
> a *csv in my Excel 2011 on Mac OS X and then I try to import it. I
follow
> the steps in this video (exept that I am working on
> Mac):http://www.youtube.com/watch?v=JgQBPoJeeLY
>
> (Tue Jan 24 11:05:42 2012)
> v.in.ascii input=/Users/.../InputForGRASS.csv output=Stations fs=;
skip=1
> x=2 y=3
> Scanning input for column types...
> Maximum input row length: 31
> Maximum number of columns: 2
> Minimum number of columns: 2
> ERROR: y column number > minimum last column number
> (incorrect field separator?)
> (Tue Jan 24 11:05:42 2012) Command finished (0 sec)
>
>
> So I opened the file with textwrangler to check it. I changed the line
> endings from the original mac endings(CR) to Unix style (LF) and saved
the
> file again, but I get the same error. I don't know what I am doing
wrong.
> Even if I copy and paste the coordinates from the text file into the
> dialog I get the error. I also tried it with G6.5SVN (some weeks old)
>
> I attached the original *.csv file so maybe someone of you can tell me
> what is wrong with my import.
>
> Thanks for your help in advance.
>
> /johannes
> --
> "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>

--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail