1
# This script tests v.pack and v.unpack
3
# We specific a small region in the
5
# The region setting should work for UTM and LL test locations
6
g.region s=0 n=70 w=0 e=100 b=0 t=50 -p
8
# We need different vector maps, with and without tables
9
# and with multiple layers
10
v.random --o -z output=probe_1 n=100 zmin=0 zmax=100 seed=1
11
v.random --o -z output=probe_2 n=100 zmin=0 zmax=100 column=height seed=1
12
v.random --o -z output=probe_orig n=100 zmin=0 zmax=100 column=height seed=1
13
# Adding new layer with categories
14
v.category input=probe_orig out=probe_3 option=transfer layer=1,2,3 --o
16
# Creating new tables for each layer
17
db.copy from_table=probe_orig to_table=probe_3_1
18
db.copy from_table=probe_orig to_table=probe_3_2
19
db.copy from_table=probe_orig to_table=probe_3_3
21
# Removing un-needed vectors and tables
22
g.remove -f type=vector name=probe_orig
23
v.db.droptable -f map=probe_3 table=probe_3 layer=1
25
# Adding tables to layer
26
v.db.addtable --o map=probe_3 table=probe_3_1 layer=1
27
v.db.addtable --o map=probe_3 table=probe_3_2 layer=2
28
v.db.addtable --o map=probe_3 table=probe_3_3 layer=3
30
# First we @test the packing/export with v.pack
31
v.pack --o input=probe_1
32
v.pack --o input=probe_2
33
v.pack --o input=probe_3
35
v.pack --o -c input=probe_1 output=probe_1_uncompressed.pack
36
v.pack --o -c input=probe_2 output=probe_2_uncompressed.pack
37
v.pack --o -c input=probe_3 output=probe_3_uncompressed.pack
39
# We need to clean before import
40
g.remove -f type=vector name=probe_1,probe_2,probe_3
42
# Test the compressed import with v.unpack
43
v.unpack --o input=probe_1.pack
44
v.category input=probe_1 option=report
45
v.unpack --o input=probe_2.pack
46
v.category input=probe_2 option=report
47
v.unpack --o input=probe_3.pack
48
v.category input=probe_3 option=report
50
# Test the uncompressed import with v.unpack (Seems to fail?)
51
v.unpack --o input=probe_1_uncompressed.pack output=probe_1_uncompressed
52
v.category input=probe_1_uncompressed option=report
53
v.unpack --o input=probe_2_uncompressed.pack output=probe_2_uncompressed
54
v.category input=probe_2_uncompressed option=report
55
v.unpack --o input=probe_3_uncompressed.pack output=probe_3_uncompressed
56
v.category input=probe_3_uncompressed option=report
58
g.remove -f type=vector name=probe_1_uncompressed,probe_2_uncompressed,probe_3_uncompressed