[GRASS-user] Merging Boundaries and Centroids

hi,

I just got stuck with a seemingly simple task:

Let's assume vector layer A holds bunch of boundaries (for example, some non-overlapping circles) without categories, while vector layer B contains points/centroids which have categories AND attributes (Soil type, etc).

What's the recipe to blend the two layers A and B into a new layer C which consists of circles having centroids with soil type attributes ?

This question is caused the fact that v.in.ascii has (for the moment) no option to import lines/areas with attributes beyond a category.

Peter
--
Dr. Peter Löwe
<peter.loewe@gmx.de>

Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01

On 19/03/09 18:34, peter.loewe@gmx.de wrote:

hi,

I just got stuck with a seemingly simple task:

Let's assume vector layer A holds bunch of boundaries (for example,
some non-overlapping circles) without categories, while vector layer
B contains points/centroids which have categories AND attributes
(Soil type, etc).

What's the recipe to blend the two layers A and B into a new layer C
which consists of circles having centroids with soil type attributes
?

This question is caused the fact that v.in.ascii has (for the moment)
no option to import lines/areas with attributes beyond a category.

If the question concerns two layers in GRASS: v.patch.

If the question concerns import of ascii file with attributes: the easiest is probably to import the features with category, import the table separately with db.in.ogr and then link the two with db.connect.

Moritz

peter.loewe@gmx.de wrote:

hi,

I just got stuck with a seemingly simple task:

Let's assume vector layer A holds bunch of boundaries (for example, some non-overlapping circles) without categories, while vector layer B contains points/centroids which have categories AND attributes (Soil type, etc).

What's the recipe to blend the two layers A and B into a new layer C which consists of circles having centroids with soil type attributes ?
  

You can do this with v.patch, *provided* that both vectors have equivalent attribute table columns. So first on your vector A run v.db.addtable and use the ' colums="..." ' option to add the same attribute columns as are in vector B. Now run v.patch with the -e switch. You should end up with an output vector including boundaries (with no cat and no attributes) and centroids with the attributes.

This question is caused the fact that v.in.ascii has (for the moment) no option to import lines/areas with attributes beyond a category.
  

As far as I know, you should certainly be able to import attributes using v.in.ascii. Again use the ' columns="..." ' option to define columns in the vector which are equivalent to the attribute columns in the ascii file. The attribs will again be attached to the *centroids*, not the boundaries.
--
Micha

Peter
  

On 20/03/09 09:28, Micha Silver wrote:

peter.loewe@gmx.de wrote:

hi,

I just got stuck with a seemingly simple task:

Let's assume vector layer A holds bunch of boundaries (for example, some non-overlapping circles) without categories, while vector layer B contains points/centroids which have categories AND attributes (Soil type, etc).

What's the recipe to blend the two layers A and B into a new layer C which consists of circles having centroids with soil type attributes ?
  

You can do this with v.patch, *provided* that both vectors have equivalent attribute table columns.

If you can use the append flag (-a) you don't need to have matching tables. Just v.patch -a input=LayerA output=LayerB.

This question is caused the fact that v.in.ascii has (for the moment) no option to import lines/areas with attributes beyond a category.
  

As far as I know, you should certainly be able to import attributes using v.in.ascii. Again use the ' columns="..." ' option to define columns in the vector which are equivalent to the attribute columns in the ascii file. The attribs will again be attached to the *centroids*, not the boundaries.

From the man page:

columns=name
     Column definition in SQL style (points mode)

So, not possible for lines/areas. I guess this is due to the more complicated file format for lines and areas which makes it difficult to integrate attributes.

Moritz

Hi Moritz:
Thanks for the corrections.
--
Micha

Moritz Lennert wrote:

You can do this with v.patch, *provided* that both vectors have equivalent attribute table columns.

If you can use the append flag (-a) you don't need to have matching tables. Just v.patch -a input=LayerA output=LayerB.

From the man page:

columns=name
    Column definition in SQL style (points mode)

So, not possible for lines/areas. I guess this is due to the more complicated file format for lines and areas which makes it difficult to integrate attributes.

Moritz

The "v.patch -a --o" sequence is just what was needed.

Thank you !

Peter
-------- Original-Nachricht --------

Datum: Fri, 20 Mar 2009 12:53:46 +0200
Von: Micha Silver <micha@arava.co.il>
An: Moritz Lennert <mlennert@club.worldonline.be>
CC: peter.loewe@gmx.de, grass-user@lists.osgeo.org
Betreff: Re: [GRASS-user] Merging Boundaries and Centroids

Hi Moritz:
Thanks for the corrections.
--
Micha

Moritz Lennert wrote:
>
>>>
>> You can do this with v.patch, *provided* that both vectors have
>> equivalent attribute table columns.
>
> If you can use the append flag (-a) you don't need to have matching
> tables. Just v.patch -a input=LayerA output=LayerB.
>
>
> From the man page:
>
> columns=name
> Column definition in SQL style (points mode)
>
> So, not possible for lines/areas. I guess this is due to the more
> complicated file format for lines and areas which makes it difficult
> to integrate attributes.
>
> Moritz
>

--
Dr. Peter Löwe
<peter.loewe@gmx.de>

Aufgepasst: Sind Ihre Daten beim Online-Banking auch optimal geschützt?
Jetzt absichern: https://homebanking.gmx.net/?mc=mail@footer.hb