t.vect.export.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. #% keyword: temporal
  19. #% keyword: export
  20. #% keyword: vector
  21. #% keyword: time
  22. #%end
  23. #%option G_OPT_STVDS_INPUT
  24. #%end
  25. #%option G_OPT_F_OUTPUT
  26. #% description: Name of a space time vector dataset archive
  27. #%end
  28. #%option G_OPT_M_DIR
  29. #% key: directory
  30. #% description: Path to the work directory, default is /tmp
  31. #% required: no
  32. #% answer: /tmp
  33. #%end
  34. #%option
  35. #% key: compression
  36. #% type: string
  37. #% description: Compression method of the tar archive
  38. #% required: no
  39. #% multiple: no
  40. #% options: no,gzip,bzip2
  41. #% answer: bzip2
  42. #%end
  43. #%option
  44. #% key: format
  45. #% type: string
  46. #% label: The export format of a single vector map
  47. #% description: Supported are GML via v.out.ogr and the GRASS package format of v.pack
  48. #% required: no
  49. #% multiple: no
  50. #% options: GML,pack
  51. #% answer: GML
  52. #%end
  53. #%option G_OPT_T_WHERE
  54. #%end
  55. import grass.script as grass
  56. import grass.temporal as tgis
  57. ############################################################################
  58. def main():
  59. # Get the options
  60. _input = options["input"]
  61. output = options["output"]
  62. compression = options["compression"]
  63. directory = options["directory"]
  64. where = options["where"]
  65. _format = options["format"]
  66. # Make sure the temporal database exists
  67. tgis.init()
  68. # Export the space time raster dataset
  69. tgis.export_stds(
  70. _input, output, compression, directory, where, _format, "stvds")
  71. ############################################################################
  72. if __name__ == "__main__":
  73. options, flags = grass.parser()
  74. main()