[GRASS-user] ascii to dem

Hamish hamish_nospam at yahoo.com
Thu Mar 15 21:26:20 EDT 2007


antonio rodriguez wrote:
> Hamish escribió:
> > antonio rodriguez wrote:
> >   
> >> I have imported into GRASS an ascii file (bathymetry) like this:
> >>
> >> r.in.ascii in=/home/toni/tmp/38n34n9w2w/baty2.xyz out=bati
> >>
> >> north:   38
> >> south:   34
> >> east:    -2
> >> west:    -9
> >> rows:    241
> >> cols:    421
> >> -9                  38      -137
> >> -8.98333        38      -127
> >> -8.96667        38      -119
> >> -8.95               38      -112
> >> -8.93333        38      -101
> >> -8.91667        38      -81
> >> -8.9                38      -63
> >> -8.88333        38      -45
> >> -8.86667        38      1
> >> -8.85               38      8
> >>
> >> How do I transform it into a 'typical' dem map. It's to say a 
> >> continous-aspect dem map not a dotted-aspect one?
> >
> > That looks like x,y,z data, not a 2D ASCII array. r.in.ascii wants a
> > 2D array of z values, x,y are calculated from header. (see the
> > example in the help page)
> >
> >
> > Use r.in.xyz to import your data after crafting g.region settings by
> > hand.
> >   
> Hi Hamish,
> 
> I understand the issue of using r.in.xyz but I'm having problems with 
> the import:
> 
> r.in.xyz z=3 fs='space' input=baty2.xyz out=baty
> 
> Scanning data ...
> ERROR:Not enough data columns. Incorrect delimiter or column number?
> Found
>       the following character(s) in row 1:
>       [north: 38]
> 
> If I erase the header of baty2.xyz (the first six lines above):

Correct. You could also have commented them out with the hash (#) char:
# north:
# south:
...

> r.in.xyz z=3 fs='space' input=baty2.xyz out=baty
> 
> Scanning data ...
> ERROR:Not enough data columns. Incorrect delimiter or column number?
> Found
>       the following character(s) in row 1:
>       [-9 38 -137]
> 
> Don't know what I'm doing wrong since the 1st column holds the x's 
> (longitude) values, the 2nd column, lat values, and 3rd column the z 
> values (elevation +/-) The column delimiter is 'space'


try fs=tab, or fs=space without the 'quotes' (if done from the GUI
window, from the command line 'quotes' shouldn't matter).
AndI think it is hoping for just one space,

this might help:

cat bathy2.xyz | awk '{print $1 $2 $3}' > bathy3.txt

?

Hamish




More information about the grass-user mailing list