Convert all GRASS 6 vector maps to GRASS 7: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(+Can I reopen the vector maps later in GRASS GIS 6?)
m (remove hardcoded version specific urls, use latest version)
 
(5 intermediate revisions by 2 users not shown)
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}} 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}} and {{cmd|v.db.reconnect.all}}).
 
Run this in GRASS GIS 7:


Run this in GRASS 7:
'''Important note:''' Backup your mapset before doing this procedure!


<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
# 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
v.db.reconnect.all -cd
</source>
</source>
Ready.


=== FAQ ===
=== FAQ ===


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


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


<source lang="bash">
<source lang="bash">
Line 26: Line 35:
</source>
</source>


Then the vector maps of the current mapset will be readable by GRASS GIS 6 again.
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/


[[Category: FAQ]]
[[Category: FAQ]]
[[Category: Vector]]
[[Category: Vector]]

Latest revision as of 10:41, 4 December 2018

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/