t.vect.export.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. ############################################################################
  4. #
  5. # MODULE: t.vect.export
  6. # AUTHOR(S): Soeren Gebbert
  7. #
  8. # PURPOSE: Export a space time vector dataset.as GRASS specific archive file
  9. # COPYRIGHT: (C) 2011-2014 by the GRASS Development Team
  10. #
  11. # This program is free software under the GNU General Public
  12. # License (version 2). Read the file COPYING that comes with GRASS
  13. # for details.
  14. #
  15. #############################################################################
  16. #%module
  17. #% description: Exports a space time vector dataset as GRASS GIS specific archive file.
  18. #% keywords: temporal
  19. #% keywords: export
  20. #% keywords: vector
  21. #%end
  22. #%option G_OPT_STVDS_INPUT
  23. #%end
  24. #%option G_OPT_F_OUTPUT
  25. #% description: Name of a space time vector dataset archive
  26. #%end
  27. #%option G_OPT_M_DIR
  28. #% key: directory
  29. #% description: Path to the work directory, default is /tmp
  30. #% required: no
  31. #% answer: /tmp
  32. #%end
  33. #%option
  34. #% key: compression
  35. #% type: string
  36. #% description: Compression method of the tar archive
  37. #% required: no
  38. #% multiple: no
  39. #% options: no,gzip,bzip2
  40. #% answer: bzip2
  41. #%end
  42. #%option
  43. #% key: format
  44. #% type: string
  45. #% label: The export format of a single vector map
  46. #% description: Supported are GML via v.out.ogr and the GRASS package format of v.pack
  47. #% required: no
  48. #% multiple: no
  49. #% options: GML,pack
  50. #% answer: GML
  51. #%end
  52. #%option G_OPT_T_WHERE
  53. #%end
  54. import grass.script as grass
  55. import grass.temporal as tgis
  56. ############################################################################
  57. def main():
  58. # Get the options
  59. _input = options["input"]
  60. output = options["output"]
  61. compression = options["compression"]
  62. directory = options["directory"]
  63. where = options["where"]
  64. _format = options["format"]
  65. # Make sure the temporal database exists
  66. tgis.init()
  67. # Export the space time raster dataset
  68. tgis.export_stds(
  69. _input, output, compression, directory, where, _format, "stvds")
  70. ############################################################################
  71. if __name__ == "__main__":
  72. options, flags = grass.parser()
  73. main()