[GRASSLIST:8182] Re: New use--concat columns, join segments by attribute?

Radim Blazek radim.blazek at gmail.com
Tue Sep 6 03:17:35 EDT 2005


On 9/5/05, Steven Gordon <sg at cartagram.com> wrote:
> Hello,
> 
> Just subscribed to the GRASS List. I installed GRASS yesterday and
> got pretty far with it, despite not having a GIS or a UNIX background.
> 
> Two questions:
> 
> (1) Can GRASS's "Build polylines from line segments" join line
> segments based on a common attribute in a table? For example, if the
> table has "street name" as a column, can street segments be joined
> together that share the same name attribute?

You have to write small script and cycle through all unique attributes, example:
v.in.ascii -e output=viapri_pol
for CODE in  `echo "select distinct str_cd from viapri" | db.select -c`
do
    v.extract -t input=viapri output=tmp0 where="str_cd = $CODE"
    v.build.polylines input=tmp0 output=tmp1
    v.category input=tmp1 output=tmp2 option=del
    v.category input=tmp2 output=tmp3 layer=2 cat=$CODE step=0
    v.patch -a input=tmp3 output=viapri_pol
done

(In this case str_cd is integer so it can be used as cat.)
 
> (2) Does GRASS have a way of concatenating two columns of data in a
> table? If one column is FENAME and another is FETYPE, can a new
> column be built that has both FENAME and FETYPE values (but separated
> by a space)?

Not with DBF driver, with Postgres usualy it is not necessary to 
create a new column because you can use directly 'col1 || col2'
as GRASS option.

Radim
 
> Thanks for you help.
> 
>    Steven Gordon
> 
>




More information about the grass-user mailing list