[GRASS-user] Collapsing many layers into 1

Hello,

The census 2000 administrative boundaries are shapefiles, where every
county is a separate file. So v.in.ogr creates a layer for every
county. So for example, I get 83 layers for the 83 counties in
Michigan, which correspond to 83 tables, each with just one category.

What I want is one layer with 83 categories. I've had no luck with
v.overlay, v.extract, v.patch, etc. because all those tools preserve the
layers in the output map.

Is there any way to do this?

Thanks,
Neil

Hi,

2008/1/22, Neil Godfrey <neil@thegodfreys.net>:

The census 2000 administrative boundaries are shapefiles, where every
county is a separate file. So v.in.ogr creates a layer for every
county. So for example, I get 83 layers for the 83 counties in
Michigan, which correspond to 83 tables, each with just one category.

What I want is one layer with 83 categories. I've had no luck with
v.overlay, v.extract, v.patch, etc. because all those tools preserve the
layers in the output map.

Is there any way to do this?

If the attribute tables have the same structure (number of columns,
data types and key column), you can patch maps using

v.patch -e in=`g.mlist vect pat='con*' out=con_patch
v.clean in=con_patch out=con_clean tool=snap,break,rmdupl thresh=[value]

?

Martin

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

My problem is a little different. I have just one map, but many layers.
I want to get one map, with just one layer.

On Tue, 2008-01-22 at 10:58 +0100, Martin Landa wrote:

Hi,

2008/1/22, Neil Godfrey <neil@thegodfreys.net>:
> The census 2000 administrative boundaries are shapefiles, where every
> county is a separate file. So v.in.ogr creates a layer for every
> county. So for example, I get 83 layers for the 83 counties in
> Michigan, which correspond to 83 tables, each with just one category.
>
> What I want is one layer with 83 categories. I've had no luck with
> v.overlay, v.extract, v.patch, etc. because all those tools preserve the
> layers in the output map.
>
> Is there any way to do this?

If the attribute tables have the same structure (number of columns,
data types and key column), you can patch maps using

v.patch -e in=`g.mlist vect pat='con*' out=con_patch
v.clean in=con_patch out=con_clean tool=snap,break,rmdupl thresh=[value]

?

Martin

Hi,

2008/1/23, Neil Godfrey <neil@thegodfreys.net>:

My problem is a little different. I have just one map, but many layers.
I want to get one map, with just one layer.

you can use `v.category chlayer=` to change layer number, but it will
not touch attribute data.

v.category in=map out=map_1 chlayer=2,1,3,1,4,1

You can also extract layers to single-layer vector maps and the to patch them.

for layer in `seq 2 10`; do
v.extract in=map out=map_${layer} layer=$layer where=cat>0;
done

v.patch in=`g.mlist vect pat=map_*` out=map_patch -e
v.clean ...

Martin

On Tue, 2008-01-22 at 10:58 +0100, Martin Landa wrote:
> Hi,
>
> 2008/1/22, Neil Godfrey <neil@thegodfreys.net>:
> > The census 2000 administrative boundaries are shapefiles, where every
> > county is a separate file. So v.in.ogr creates a layer for every
> > county. So for example, I get 83 layers for the 83 counties in
> > Michigan, which correspond to 83 tables, each with just one category.
> >
> > What I want is one layer with 83 categories. I've had no luck with
> > v.overlay, v.extract, v.patch, etc. because all those tools preserve the
> > layers in the output map.
> >
> > Is there any way to do this?
>
> If the attribute tables have the same structure (number of columns,
> data types and key column), you can patch maps using
>
> v.patch -e in=`g.mlist vect pat='con*' out=con_patch
> v.clean in=con_patch out=con_clean tool=snap,break,rmdupl thresh=[value]
>
> ?
>
> Martin
>

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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

Hi,

2008/1/23, Martin Landa <landa.martin@gmail.com>:

v.category in=map out=map_1 chlayer=2,1,3,1,4,1

ops, sorry, of course

v.category in=map out=map_1 opt=chlayer layer=2,1,3,1,4,1

Martin

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