[GRASSLIST:2938] data imput

i am a newbe, i had a look in the archives and couldn't find what i was looking for. I am attempting to plot a series of points on to a map. i created a CSV file using excel, 3 columns long. lat and site name. using grass 5.0.2 on Mac OSX. i attempted to import using s.in.ascii but failed.

The output:

s.in.ascii - line 2 ** invalid format **
51.60745351 -2.462143461 C>ickladerovensel
  s.in.ascii - line 3 ** invalid format **
50.95993341 -2.469930701 Goathill>_St_Peterd

Couple more lines in same format, i assume that it doesn't like the co-ordinate system, why?

The input, The first few lines,

51.71 -1.88 Ampney_St_Peter
50.74 -2.27 Askerswell
51.39 -2.2 Atworth
51.71 -2.55 Aylburton
51.53 -1.73 Badbury
51.21 -2.67 Badger Hole
51.55 -2.29 Badminton
51.34 -2.86 "Banwel_Rliverside"
51.34 -2.86 "Banwell_Winthill"
51.76 -1.88 Barnsley_Park
51.82 -1.71 Barrington_Park
51.76 -1.97 Barton_Farm
51.39 -2.33 Bathampton
51.3921163 -2.316229421 Bathford
51.40114675 -2.301914768 Bathford
51.14592931 -2.943640653 Bawdrip
51.05528912 -0.972583174 Bayford_Lodge
51.41788952 -2.618434278 Bedminster
51.75211021 -1.826143485 Bibury
51.824118 -2.116089022 Birdlip
51.91389265 -2.218100807 Bishops_Norton
52.08179284 -2.861085814 Bishopstone
51.73418223 -2.130340767 Bisley
51.66958563 -2.636317653 Boughspring
51.42850999 -2.02877093 Bowood_House
51.41024247 -2.258835361 Box
50.93244085 -2.583509737 Bradford_Abbas

Could anyone suggest where i went wrong, thanks

Martin O'Loughlin

Your problem might be that you're using Mac line breaks instead of Unix. Macs traditionally used a different character to indicate line breaks from Windows or Unix. It's changed now with OSX - I get the impression that programs are inconsistent in whether they use the old Mac or new Unix/OSX breaks. GRASS expects UNIX line breaks and will fail if you use Mac line breaks. There are a number of programs which will convert from one to another; I use BBEdit; there's a free version available at versiontracker (http://www.versiontracker.com/dyn/moreinfo/macosx/604). Open your text file in BBEdit; there should be a series of little icons at the top of the document, one of which is a file icon; pull down this menu, and you should see the first three items as "Macintosh", "Unix" and "DOS". If your document has "Macintosh" checked, change it to "Unix", save and try again. Again there are other ways to do this, probably more efficient; but this has worked for me. Good luck,

Nick Cahill

On Mar 14, 2004, at 3:26 AM, Martin O'Loughlin wrote:

i am a newbe, i had a look in the archives and couldn't find what i was looking for. I am attempting to plot a series of points on to a map. i created a CSV file using excel, 3 columns long. lat and site name. using grass 5.0.2 on Mac OSX. i attempted to import using s.in.ascii but failed.

The output:

s.in.ascii - line 2 ** invalid format **
51.60745351 -2.462143461 C>ickladerovensel
s.in.ascii - line 3 ** invalid format **
50.95993341 -2.469930701 Goathill>_St_Peterd

Couple more lines in same format, i assume that it doesn't like the co-ordinate system, why?

The input, The first few lines,

51.71 -1.88 Ampney_St_Peter
50.74 -2.27 Askerswell
51.39 -2.2 Atworth
51.71 -2.55 Aylburton
51.53 -1.73 Badbury
51.21 -2.67 Badger Hole
51.55 -2.29 Badminton
51.34 -2.86 "Banwel_Rliverside"
51.34 -2.86 "Banwell_Winthill"
51.76 -1.88 Barnsley_Park
51.82 -1.71 Barrington_Park
51.76 -1.97 Barton_Farm
51.39 -2.33 Bathampton
51.3921163 -2.316229421 Bathford
51.40114675 -2.301914768 Bathford
51.14592931 -2.943640653 Bawdrip
51.05528912 -0.972583174 Bayford_Lodge
51.41788952 -2.618434278 Bedminster
51.75211021 -1.826143485 Bibury
51.824118 -2.116089022 Birdlip
51.91389265 -2.218100807 Bishops_Norton
52.08179284 -2.861085814 Bishopstone
51.73418223 -2.130340767 Bisley
51.66958563 -2.636317653 Boughspring
51.42850999 -2.02877093 Bowood_House
51.41024247 -2.258835361 Box
50.93244085 -2.583509737 Bradford_Abbas

Could anyone suggest where i went wrong, thanks

Martin O'Loughlin

  I just opened the file in Vi and between every group of items is a <ctrl>M, would this be the problem?

?Thanks Martin O'Loughlin

On 14 Mar 2004, at 19:50, Nick Cahill wrote:

Your problem might be that you're using Mac line breaks instead of Unix. Macs traditionally used a different character to indicate line breaks from Windows or Unix. It's changed now with OSX - I get the impression that programs are inconsistent in whether they use the old Mac or new Unix/OSX breaks. GRASS expects UNIX line breaks and will fail if you use Mac line breaks. There are a number of programs which will convert from one to another; I use BBEdit; there's a free version available at versiontracker (http://www.versiontracker.com/dyn/moreinfo/macosx/604). Open your text file in BBEdit; there should be a series of little icons at the top of the document, one of which is a file icon; pull down this menu, and you should see the first three items as "Macintosh", "Unix" and "DOS". If your document has "Macintosh" checked, change it to "Unix", save and try again. Again there are other ways to do this, probably more efficient; but this has worked for me. Good luck,

Nick Cahill

On Mar 14, 2004, at 3:26 AM, Martin O'Loughlin wrote:

i am a newbe, i had a look in the archives and couldn't find what i was looking for. I am attempting to plot a series of points on to a map. i created a CSV file using excel, 3 columns long. lat and site name. using grass 5.0.2 on Mac OSX. i attempted to import using s.in.ascii but failed.

The output:

s.in.ascii - line 2 ** invalid format **
51.60745351 -2.462143461 C>ickladerovensel
s.in.ascii - line 3 ** invalid format **
50.95993341 -2.469930701 Goathill>_St_Peterd

Couple more lines in same format, i assume that it doesn't like the co-ordinate system, why?

The input, The first few lines,

51.71 -1.88 Ampney_St_Peter
50.74 -2.27 Askerswell
51.39 -2.2 Atworth
51.71 -2.55 Aylburton
51.53 -1.73 Badbury
51.21 -2.67 Badger Hole
51.55 -2.29 Badminton
51.34 -2.86 "Banwel_Rliverside"
51.34 -2.86 "Banwell_Winthill"
51.76 -1.88 Barnsley_Park
51.82 -1.71 Barrington_Park
51.76 -1.97 Barton_Farm
51.39 -2.33 Bathampton
51.3921163 -2.316229421 Bathford
51.40114675 -2.301914768 Bathford
51.14592931 -2.943640653 Bawdrip
51.05528912 -0.972583174 Bayford_Lodge
51.41788952 -2.618434278 Bedminster
51.75211021 -1.826143485 Bibury
51.824118 -2.116089022 Birdlip
51.91389265 -2.218100807 Bishops_Norton
52.08179284 -2.861085814 Bishopstone
51.73418223 -2.130340767 Bisley
51.66958563 -2.636317653 Boughspring
51.42850999 -2.02877093 Bowood_House
51.41024247 -2.258835361 Box
50.93244085 -2.583509737 Bradford_Abbas

Could anyone suggest where i went wrong, thanks

Martin O'Loughlin

  I just opened the file in Vi and between every group of items is a
<ctrl>M, would this be the problem?

?Thanks Martin O'Loughlin

there is a quick way to deal with this in a UNIX environment:
a small program called 'flip' will convert between DOS (^M) and UNIX style
line endings. it is apt-gettable by the package name 'flip' since you are
on OSX, you might want to try converting the line endings with something
like awk or sed.

-dylan

On 14 Mar 2004, at 19:50, Nick Cahill wrote:

Your problem might be that you're using Mac line breaks instead of
Unix. Macs traditionally used a different character to indicate line
breaks from Windows or Unix. It's changed now with OSX - I get the
impression that programs are inconsistent in whether they use the old
Mac or new Unix/OSX breaks. GRASS expects UNIX line breaks and will
fail if you use Mac line breaks. There are a number of programs which
will convert from one to another; I use BBEdit; there's a free version
available at versiontracker
(http://www.versiontracker.com/dyn/moreinfo/macosx/604). Open your
text file in BBEdit; there should be a series of little icons at the
top of the document, one of which is a file icon; pull down this menu,
and you should see the first three items as "Macintosh", "Unix" and
"DOS". If your document has "Macintosh" checked, change it to "Unix",
save and try again. Again there are other ways to do this, probably
more efficient; but this has worked for me. Good luck,

Nick Cahill

On Mar 14, 2004, at 3:26 AM, Martin O'Loughlin wrote:

i am a newbe, i had a look in the archives and couldn't find what i
was looking for. I am attempting to plot a series of points on to a
map. i created a CSV file using excel, 3 columns long. lat and site
name. using grass 5.0.2 on Mac OSX. i attempted to import using
s.in.ascii but failed.

The output:

s.in.ascii - line 2 ** invalid format **
51.60745351 -2.462143461 C>ickladerovensel
s.in.ascii - line 3 ** invalid format **
50.95993341 -2.469930701 Goathill>_St_Peterd

Couple more lines in same format, i assume that it doesn't like the
co-ordinate system, why?

The input, The first few lines,

51.71 -1.88 Ampney_St_Peter
50.74 -2.27 Askerswell
51.39 -2.2 Atworth
51.71 -2.55 Aylburton
51.53 -1.73 Badbury
51.21 -2.67 Badger Hole
51.55 -2.29 Badminton
51.34 -2.86 "Banwel_Rliverside"
51.34 -2.86 "Banwell_Winthill"
51.76 -1.88 Barnsley_Park
51.82 -1.71 Barrington_Park
51.76 -1.97 Barton_Farm
51.39 -2.33 Bathampton
51.3921163 -2.316229421 Bathford
51.40114675 -2.301914768 Bathford
51.14592931 -2.943640653 Bawdrip
51.05528912 -0.972583174 Bayford_Lodge
51.41788952 -2.618434278 Bedminster
51.75211021 -1.826143485 Bibury
51.824118 -2.116089022 Birdlip
51.91389265 -2.218100807 Bishops_Norton
52.08179284 -2.861085814 Bishopstone
51.73418223 -2.130340767 Bisley
51.66958563 -2.636317653 Boughspring
51.42850999 -2.02877093 Bowood_House
51.41024247 -2.258835361 Box
50.93244085 -2.583509737 Bradford_Abbas

Could anyone suggest where i went wrong, thanks

Martin O'Loughlin

i attempted to import using s.in.ascii but failed.

The output:

s.in.ascii - line 2 ** invalid format **
51.60745351 -2.462143461 C>ickladerovensel
  s.in.ascii - line 3 ** invalid format **
50.95993341 -2.469930701 Goathill>_St_Peterd

Couple more lines in same format, i assume that it doesn't like the
co-ordinate system, why?

The input, The first few lines,

51.71 -1.88 Ampney_St_Peter
50.74 -2.27 Askerswell
51.39 -2.2 Atworth

Be sure to "quote" any multi-word site label or any with special
characters.

Is "C>ickladerovensel" and "Goathill>_St_Peterd" the correct labels or
have they been munched? As is, they imported properly here..

Hamish

Martin O'Loughlin wrote:

  I just opened the file in Vi and between every group of items is a
<ctrl>M, would this be the problem?

Yes. ^M (aka CR, "carriage return", '\r', ASCII 13) is the old Mac
line separator. Unix uses ^J (aka LF, "line feed", '\n', ASCII 10).

You can convert the file with:

  tr '\r' '\n' < oldfile > newfile

--
Glynn Clements <glynn.clements@virgin.net>