[GRASS-user] Trouble with v.in.ascii (x2) and v.out.ogr

Hamish hamish_b at yahoo.com
Wed Jun 18 05:11:08 EDT 2008

Paulo Marcondes wrote:

> I had issues while triyng to import an ASCII vector file,
> that looks like this:
>  B 240 1
>   333967.494 7610503.977
>   334065.141 7610992.215
>   334260.436 7610601.634
>  1 1
> This should be a polygon that limits a very interesting
> feature.

missing a centroid?

> Also, I didn't manage to, while exporting to shape,
> have the polygon filled. (the GRASS polygon fills OK)

see example in v.out.ogr help page for areas -> shapefile.

> Also, I had issues while trying to import an 815k lines
> ASCII vector file,
> that looks like this:
> DIGIT DATE:   10/06/2008
> MAP NAME:     Isopach
> MAP DATE:     2008
> OTHER INFO:   Geodetic Info
> MAP THRESH:   100
> P 815257 1
>  287750.911964  7501478.351623  -140.000000
> ...

Not sure, do you need one coordinate per "P"?
if only points, probably better to use "v.in.ascii format=point"
and forget about all the formatting stuff, just give it a flat .csv file.

> and got the following:
> Maximum input row length: 42
> Maximum number of columns: 3
> Minimum number of columns: 1
> WARNING: Cannot remove directory
> '/u/user/gisdata/Location/PERMANENT/.tmp/soledade/23183.1'
> ERROR: y column number > minimum last column number
>       (incorrect field separator?)

you need to use v.in.ascii's "format=standard" if data is given in that form. "standard" format is not the default and should be renamed for GRASS 7 as the name is somewhat misleading.
Did it used to be "format=grass" ?

> This file represents a XYZ triplet for each point along a
> grid over said interesting feature. Z values meaning the
> variable of interest =]
> The grid is has 100x100m cells and GRASS region resolution
> is:
> nsres:      99.97437069
> ewres:      100.01647621
> that I have defined previously with
> $ g.region res=100 (also, g.region nsres=100 ewres=100
> yields the same region resolution)
> When I imported (almost) the same ASCII file with r.in.xyz,
> somewhere in the northern part of the raster I got a blank
> E-W line, that I feel has something to do with that resolution
> difference (99.97 vs 100m)

probably that is correct, caused by a partial Moiré effect.

adjust the res to be exactly 100 by expanding the bounds of the region with "g.region res=100 -a".

grass uses the grid as cell bounds, not cell centers. so west= is the coord of the left of the leftest cell, and east= is the coord of the right of the rightest cell.
ie 0,0 falls on a grid confluence, not a cell center.

> So, what I tried to do was import as vector points to
> interpolate and generate a nice raster.

I've had success with that method + r.in.xyz, see
tip: use a "n" map + r.univar to check that your alignment is correct.



More information about the grass-user mailing list