test_topology_vgeneralize.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. ############################################################################
  3. #
  4. # TEST: test_topology_vgeneralize
  5. # AUTHOR(S): Markus Metz
  6. #
  7. # PURPOSE: Tests if the topology is correct using v.generalize debug mode
  8. # COPYRIGHT: (C) 2011-2014 by Markus Metz and the GRASS Development Team
  9. #
  10. # This program is free software under the GNU General Public
  11. # License (version 2). Read the file COPYING that comes with GRASS
  12. # for details.
  13. #
  14. #############################################################################
  15. # The vectors in the sample datasets are "too good", I did not find a
  16. # vector to provoke any errors, thus the r.to.vect step.
  17. # Real world datasets, particularly vectors with administrative areas or
  18. # land cover/land use classification, are in this respect more suitable
  19. # because they contain lots of topological errors. Unfortunately, these
  20. # datasets are too large to be included in the sample datasets.
  21. # the script expects to run using shell with -e flag
  22. # (equivalent of set -e in a script)
  23. # prepare
  24. g.region rast=landuse
  25. r.to.vect input=landuse output=landuse type=area
  26. # use the v.generalize debug mode
  27. export GRASS_VECTOR_TOPO_DEBUG=1
  28. # test will fail if this (and any other) command fails
  29. v.generalize input=landuse output=landuse_dp method=douglas threshold=21
  30. # clean up (executed if successful)
  31. g.remove -f type=vector name=landuse
  32. g.remove -f type=raster name=landuse_dp