Convert all GRASS 6 vector maps to GRASS 7

From GRASS-Wiki
Jump to: navigation, search

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:

Important note: Backup your mapset before doing this procedure!

# 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
 
# print to verify new DB connection settings (should be SQLite)
db.connect -p
 
# 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 map(s) in the current mapset will be readable by GRASS GIS 6 again.


Q: I found a tutorial for GRASS GIS 6 which is based on the North Carolina sample dataset. Do I have to convert that myself?

A: No, you can simply download an updated North Carolina sample dataset for GRASS GIS 7 from here: http://grass.osgeo.org/download/sample-data/