[GRASS-user] Re: Re-ordering columns in an attribute table

Micha Silver Micha at arava.co.il
Mon Apr 9 02:48:13 EDT 2012


RichardC wrote
> 
> Hi,
> 
> Is there a command in GRASS to enable re-ordering of columns in an
> attribute table.
> 
> I'd like to join two vector layers, but v.patch gives an error apparently
> due to the order of a column in the tables.
> 
> Thanks,
> Richard.  
> 
> The tables:
> Table 1
> cat integer 11
> name_ENGLI character 50
> ID_0 integer 11
> ...
> 
> Table 2
> cat integer 11
> ID_0 integer 11
> name_ENGLI character 50
> ...
> 

I also think this is a database issue, there's nothing specific to GRASS to
reorder columns. Depending on what database backend your tables are in (i.e.
not dbf) , you can do something like:
CREATE TABLE table3 AS ( 
SELECT cat, name_ENGLI, ID_0, ... 
FROM table2);
THis should duplicate the "table2" table with the columns reordered like in
"table1". Now in GRASS:
v.db.connect -o map=table2_vector database=<your database connection>
driver=<your db driver> table=table3
THis step should reset the table2 vector's attribute table to the newly
reordered table "table3". THen you can try v.patch.
-- 
Micha

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Re-ordering-columns-in-an-attribute-table-tp4694655p4715249.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list