test.v.unpack.sh 2.3 KB

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