Thanks all of you for your answers :) I created the ticket as a defect [0], but please feel free to change it to enhancement if you consider so.
In the meantime, this is what I do for all columns in the attr table of my vector maps to get column order, type and width right (plus change name from uppercase to lowercase): # 1. add new column (low caps, define width if possible; date does not allow width definition) v.db.addcolumn $MAP column="start_date_new date" # 2. update values from corresponding original column v.db.update $MAP column=start_date_new query_column=START_DATE # 3. remove original column v.db.dropcolumn $MAP column=START_DATE # 4. rename newly created column v.db.renamecolumn $MAP column=start_date_new,start_date # 5. check v.db.select $MAP | head cheers, Vero [0] https://trac.osgeo.org/grass/ticket/3566 El mié., 23 may. 2018 a las 21:58, Markus Metz (< [email protected]>) escribió: > > > On Wed, May 23, 2018 at 12:41 PM, Moritz Lennert < > [email protected]> wrote: > > > > > > > > Am 23. Mai 2018 12:23:45 MESZ schrieb Stefan Blumentrath < > [email protected]>: > > >Ciao Vero, > > > > > >Unfortunately, it seems you have to create a new table with desired > > >column order, copy data into it (INSERT INTO FROM SELECT) and then link > > >the new table to your vector map (v.db.connect)…: > > > > https://stackoverflow.com/questions/20574113/sqlite3-how-to-reorder-columns-in-a-table > > > > Personally I would consider this as a bug. v.patch should match columns > by names > and type > > not order. But I haven't looked at the code yet to understand what this > would entail. > > in theory this (ignore order, check name+type match) is easy to implement. > Please open a ticket. > > Markus M > > > > Moritz > > > > > > > > > >Note that SQLite will launder column names to lower case if you don`t > > >quote them. Then they may not match even if in proper order > > >(speculating here)… > > > > > >Cheers > > >Stefan > > > > > >From: grass-user <[email protected]> On Behalf Of > > >Veronica Andreo > > >Sent: onsdag 23. mai 2018 12.12 > > >To: grass-user <[email protected]> > > >Subject: [GRASS-user] reorder columns in vector attribute table > > > > > >Hi all, > > > > > >I want to use v.patch -e to patch geometries and attributes of polygon > > >maps belonging to different states in Australia and the column names in > > >the attr tables are the same (they only vary in the order in which they > > >are) but when making an attempt, I get: > > > > > >v.patch -e input=act_bushfire_2012_2017,tas_bushfire_2012_2017 > > >output=test > > >ERROR: Column names differ > > > > > >Column names here: > > > > > >v.db.select tas_bushfire_2012_2017 | head > > >cat|FIRE_TYPE|OBJECTID|START_DATE|END_DATE|STATE|AREA_ha|PERIMETER_km > > > > > >v.db.select act_bushfire_2012_2017 > > >cat|OBJECTID|FIRE_TYPE|START_DATE|END_DATE|STATE|AREA_ha|PERIMETER_km > > > > > >only OBJECTID and FIRE_TYPE are shifted. > > > > > >Is there an easy way to reorder columns in the attribute table of a > > >vector map?? I thought v.patch would match column names in the attr > > >table... > > > > > >Thanks much in advance, > > >Vero > > _______________________________________________ > > grass-user mailing list > > [email protected] > > https://lists.osgeo.org/mailman/listinfo/grass-user > >
_______________________________________________ grass-user mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/grass-user
