Difference between revisions of "Convert all GRASS 6 vector maps to GRASS 7"

From GRASS-Wiki
Jump to: navigation, search
(+Can I reopen the vector maps later in GRASS GIS 6?)
(cleanup)
Line 1: Line 1:
 +
'''''Rationale''': GRASS GIS 7 comes with an updated vector format (see [http://trac.osgeo.org/grass/wiki/Grass7/NewFeatures new features]). In order to use older vector data (from GRASS GIS 6) in GRASS GIS 7 the user has to rebuild the topology. Additionally it is recommended to switch the database backend from DBF files to SQLite. Both can be done in an automated way per MAPSET as described below.''
 +
 
== Convert automatically all GRASS 6 vector maps to GRASS 7 (including attribute transfer from DBF to SQLite) ==
 
== Convert automatically all GRASS 6 vector maps to GRASS 7 (including attribute transfer from DBF to SQLite) ==
  
To become usable in GRASS 7, all vector maps in a mapset need to be updated to the improved vector file format (i.e., rebuild the topology with {{cmd|v.build.all|version=70}} along with the change to the SQLite database backend (new default in GRASS 7 instead of DBF in GRASS 6, using {{cmd|db.connect|version=70}} and {{cmd|v.db.reconnect.all|version=70}}).
+
To become readable in GRASS 7, all vector maps in a '''mapset''' need to be updated to the improved vector file format (i.e., rebuild the topology with {{cmd|v.build.all|version=70}} along with the change to the SQLite database backend (SQLite is the new default in GRASS 7 instead of DBF in GRASS 6, using {{cmd|db.connect|version=70}} and {{cmd|v.db.reconnect.all|version=70}}).
  
Run this in GRASS 7:
+
Run this in GRASS GIS 7:
  
 
<source lang="bash">
 
<source lang="bash">
# first rebuild topology for all vector maps
+
# first rebuild topology for all vector maps in current mapset
 
v.build.all
 
v.build.all
  
# set new default db connection (from DBF to new SQLite default)
+
# define new default DB connection (switch from DBF to SQLite)
 
db.connect -d
 
db.connect -d
  
# copy attribute tables from old DB to new SQLite DB, delete old tables in DBF format
+
# transfer all attribute tables from DBF to SQLite and clean old DBF tables
 
v.db.reconnect.all -cd
 
v.db.reconnect.all -cd
 
</source>
 
</source>
 +
 +
Ready.
  
 
=== FAQ ===
 
=== FAQ ===

Revision as of 01:42, 30 April 2014

Rationale: GRASS GIS 7 comes with an updated vector format (see new features). In order to use older vector data (from GRASS GIS 6) in GRASS GIS 7 the user has to rebuild the topology. Additionally it is recommended to switch the database backend from DBF files to SQLite. Both can be done in an automated way per MAPSET as described below.

Convert automatically all GRASS 6 vector maps to GRASS 7 (including attribute transfer from DBF to SQLite)

To become readable in GRASS 7, all vector maps in a mapset need to be updated to the improved vector file format (i.e., rebuild the topology with v.build.all along with the change to the SQLite database backend (SQLite is the new default in GRASS 7 instead of DBF in GRASS 6, using db.connect and v.db.reconnect.all).

Run this in GRASS GIS 7:

# first rebuild topology for all vector maps in current mapset
v.build.all

# define new default DB connection (switch from DBF to SQLite)
db.connect -d

# transfer all attribute tables from DBF to SQLite and clean old DBF tables
v.db.reconnect.all -cd

Ready.

FAQ

Q: Can I reopen the vector maps later in GRASS GIS 6?

A: Yes, but you need to rebuild the topology. Hence, run this:

v.build.all

Then the vector maps of the current mapset will be readable by GRASS GIS 6 again.