[GRASS-user] generating lines from points

Hi all,

is there any simple way how to connect selected points?

E.g. to create line starting from point with category '1' to point
with category '2'.

If not, do you consider useful something like

v.edit map tool=addline cats=1,2 layer=1

or create multiple lines

v.edit map tool=addline cats=1,2,3,4 layer=1 # line from 1 to 2 and
line from 3 to 4

Anyway, v.edit doesn't not seem to be a good module for such functionality. (?)

Sure you can always write a simple script and use v.in.ascii approach
(can be quite slow).

Martin

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

Martin,
I'm working on a script to create an area from a list of cat (here
attached), useful when we want areas from gps waypoints without direct
editing by users.

This is a very "beginner" script with not good code (work in
progress); but handle the problem of connecting point with category
'1' to point with category '2' etc.

2009/1/18 Martin Landa <landa.martin@gmail.com>:

If not, do you consider useful something like

v.edit map tool=addline cats=1,2 layer=1

or create multiple lines

v.edit map tool=addline cats=1,2,3,4 layer=1 # line from 1 to 2 and
line from 3 to 4

It would be great.

Sure you can always write a simple script and use v.in.ascii approach
(can be quite slow).

Not quite simple to me!

ciao

--
--
Paolo C.
Lat. 44° 39' 11.08'' N Long. 7° 23' 25.26'' E

(attachments)

v.points2area.txt (4.89 KB)

Hi,

2009/1/18 Paolo Craveri <pcraveri@gmail.com>:

Martin,
I'm working on a script to create an area from a list of cat (here
attached), useful when we want areas from gps waypoints without direct
editing by users.

thanks, I have already working script [1]. Anyway this approach is not
possible because of the number of the generated lines (for the first
sample I have to generate more then 2e4 lines). Sure, you can generate
lines directly in PostGIS, but it would be nice to have something in
GRASS.

The more lines you need to generate the longer list of categories will
be, not possible to give the list as the parameter. Then v.edit could
read categories from stdin, simillary to v.net.path. Hm, what about
v.net? New tool to generate network from points?

v.net input=points output=net operation=lines line_file=- << EOF
1 1 2
2 2 3
EOF

creates edges between points 1-2 and 2-3 with category 1 and 2?

Martin

[1] http://josef.fsv.cvut.cz/svn/landa/trunk/programming/sjtsk05/vect2grass.py

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

Hi,

2009/1/18 Martin Landa <landa.martin@gmail.com>:

[...]

The more lines you need to generate the longer list of categories will
be, not possible to give the list as the parameter. Then v.edit could
read categories from stdin, simillary to v.net.path. Hm, what about
v.net? New tool to generate network from points?

v.net input=points output=net operation=lines line_file=- << EOF
1 1 2
2 2 3
EOF

creates edges between points 1-2 and 2-3 with category 1 and 2?

better

v.net points=points output=net operation=net file=- << EOF
1 1 2
2 2 3
EOF

What do you think about that?

M.

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

On 18/01/09 18:08, Martin Landa wrote:

Hi,

2009/1/18 Martin Landa <landa.martin@gmail.com>:

[...]

The more lines you need to generate the longer list of categories will
be, not possible to give the list as the parameter. Then v.edit could
read categories from stdin, simillary to v.net.path. Hm, what about
v.net? New tool to generate network from points?

v.net input=points output=net operation=lines line_file=- << EOF
1 1 2
2 2 3
EOF

creates edges between points 1-2 and 2-3 with category 1 and 2?

better

v.net points=points output=net operation=net file=- << EOF
1 1 2
2 2 3
EOF

What do you think about that?

I think that a GRASS module for connecting lines between chosen points is a definite yes (think of point coordinates of airports with information about flight connections between airports). Up to now I've been doing it with a simple script + v.in.ascii.

Not sure v.net is the most logical place to have this. Maybe a stand-alone module v.points2lines ?

Moritz

Hi,

2009/1/19 Moritz Lennert <mlennert@club.worldonline.be>:

[...]

v.net points=points output=net operation=net file=- << EOF
1 1 2
2 2 3
EOF

What do you think about that?

I think that a GRASS module for connecting lines between chosen points is a
definite yes (think of point coordinates of airports with information about
flight connections between airports). Up to now I've been doing it with a
simple script + v.in.ascii.

Not sure v.net is the most logical place to have this. Maybe a stand-alone

v.net seems to be good place. There is already tool for generating
points ('nodes'), so why not tool for generating lines (arcs/edges)?
v.net updated in GRASS7 [1].

module v.points2lines ?

This could be more general module.

v.points? input=- output=lines type=line << EOF
1 1 2
2 2 3
3 4 5
EOF

creates separated lines

v.points? input=- output=area type=area << EOF
1 1 2
2 2 3
3 4 5
EOF

creates closed ring -> area

Note that `v.net operation=arcs` create vector map with two layes -
arcs (lines) and nodes (point).

Martin

[1] http://trac.osgeo.org/grass/changeset/35490

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