[GRASS-user] How to create an hull / area with v.in.ascii

Martin Landa landa.martin at gmail.com
Mon Feb 4 06:28:07 EST 2008


Hi,

2008/2/4, Philipp Steigenberger <userlist at online.de>:
> I have  cross-profiles of a river and want to create a terrainmodel.
> To interpolate only there, where points are, I want to create a hull.
> v.hull doesn't work, cause - how to explain... - imagine, the river has
> the form of the letter 'S' with v.hull I get a form whisch is almost
> like a 'D'.
>
> Therfore I extracte all the lines where I have the points of the
> right(r) /left(l) side of the cross-profile
>
> I sort them like
> cat   name
> 1         l 1
> 2         l 2
> 3         l 3
> 4         l 4
> 5         r 4
> 6         r 3
> 7         r 2
> 8         r 1
>
> so it looks like:
>
> 1 4417744.050 5363469.320 461.10400 0.20000 P1(li)
> 2 4417723.140 5363269.800 461.83000 0.40000 P1(left)
> 3 4417716.890 5363068.970 461.40100 0.60000 P1(left)
> 4 4417705.220 5362867.590 461.93600 0.80000 P1(left)
> 354 4403074.030 5335808.330 559.44700 34.00000 P2(right)
> 355 4402974.470 5335628.060 559.60400 34.20000 P2(right)
> 356 4402876.360 5335452.300 560.11700 34.40000 P2(right)
> 357 4402779.380 5335277.370 561.11800 34.60000 P2(right)
>
> I add
> A 357 1 in the first line and
> 1 1         in the last line
>
> Now I want to import this as an area:
>
> cat wertach.asc | v.in.ascii --o output=wertach skip=1 -z z=4 cat=1 x=2
> y=3 colum='cat int, x double, y double, z double, name01 varchar(20),
> name02 varchar(20)' fs=' '
>
> and get
>
> Scanning input for column types...
> Maximum input row length: 54
> Maximum number of columns: 6
> Minimum number of columns: 2
> ERROR: y column number > minimum last column number
>        (incorrect field separator?)
>
> so I delete the last line and get
>
> Scanning input for column types...
> Maximum input row length: 54
> Maximum number of columns: 6
> Minimum number of columns: 6
> WARNING: Column number 5 defined as string has double values
> Importing points...
> Populating table...
> Building topology for vector map <wertach>...
> 357 primitives registered
> Building areas:  100%
> 0 areas built
> 0 isles built
> Attaching islands:
> Attaching centroids:  100%
> Topology was built
> Number of nodes     :   357
> Number of primitives:   357
> Number of points    :   357
> Number of lines     :   0
> Number of boundaries:   0
> Number of centroids :   0
> Number of areas     :   0
> Number of isles     :   0
> v.in.ascii complete.
>
> NO AREA :o(
>
> If I try
> B 357 1 for a boundary I get the same
>
> Scanning input for column types...
> Maximum input row length: 54
> Maximum number of columns: 6
> Minimum number of columns: 6
> WARNING: Column number 5 defined as string has double values
> Importing points...
> Populating table...
> Building topology for vector map <wertach>...
> 357 primitives registered
> Building areas:  100%
> 0 areas built
> 0 isles built
> Attaching islands:
> Attaching centroids:  100%
> Topology was built
> Number of nodes     :   357
> Number of primitives:   357
> Number of points    :   357
> Number of lines     :   0
> Number of boundaries:   0
> Number of centroids :   0
> Number of areas     :   0
> Number of isles     :   0
> v.in.ascii complete.
>
> NO BOUNDARY :o(
>
> what went wrong? How to bulid an area? Do I need a centroid? How to get it?
> Or do I only need x and y -values to create the area?

Please, take a look at v.in.ascii manual page where GRASS ASCII format
is described. E.g.

B  2 1
 595521.680672 4925244.201681
 593757.983193 4917668.319328
 1     1
B  5 1
 593757.983193 4917668.319328
 593757.983193 4917668.319328
 603618.655462 4915223.193277
 606344.369748 4923801.176471
 595521.680672 4925244.201681
 1     1
B  4 1
 595521.680672 4925244.201681
 589468.991597 4926727.310924
 587945.798319 4918670.420168
 593757.983193 4917668.319328
 1     2
C  1 1
 599449.915966 4920554.369748
 1     3
C  1 1
 591072.352941 4922077.563025
 1     4

defines three boundaries (category 1,2) and two centroids (cat 3,4).

cat input.txt | v.in.ascii out=xx for=standard -n --o

Note that you need to specify input format (default format is 'points'
not 'standard'). After import you can also add missing centroids using
v.centroids module.

Martin

-- 
Martin Landa <landa.martin at gmail.com> * http://gama.fsv.cvut.cz/~landa *


More information about the grass-user mailing list