[GRASS-user] Select specific layer when copying vector map

Johannes Radinger johannesradinger at gmail.com
Tue Aug 9 04:48:45 PDT 2016


Hi,

I'd like to create from an existing GRASS vector map that has 3 layers
(with three attribute tables) a new vector map that has only one layer and
its associated attribute table (here the information related to layer 3).

What I am doing so far (in python):

# First copy the map to a new one and copy table (that of layer 3)
# that I want to re-connect to new map
grass.run_command("g.copy",
overwrite=True,
vector="oldmap,newmap")
grass.run_command("db.copy",
overwrite=True,
from_table="table_layer3",
to_table="table_layer3_copy")

# Second delete all tables of the newmap
for i in [1,2,3]:
grass.run_command("v.db.droptable",
flags="f",
map="newmap",
layer=i)

# Third reconnect a table to the newmap
grass.run_command("v.db.connect",
overwrite=True,
map="newmap",
table="table_layer3_copy")

When I check in the attribute table manager, there is only one layer listed
(layer 1).
Similarly, v.db.connect reports:
v.db.connect -p map=newmap
Vector map <newmap> is connected by layer <1/table_layer3_copy> table
<table_layer3_copy> in database [...]

However, in d.vect I can still select from all three layers that were in
the old map (-1,1,2,3),
and all of them can be displayed (with -1 specified)?
So does may newmap have three layers or only one?

How can I make the third layer the default layer 1 and remove all other
layers?
Or is there a way to copy a vector map with just a single layer and its
associated table specified as default?

Thank you very much!

/Johannes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20160809/3e281e52/attachment.html>


More information about the grass-user mailing list