t.vect.import.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. ############################################################################
  4. #
  5. # MODULE: t.vect.import
  6. # AUTHOR(S): Soeren Gebbert
  7. #
  8. # PURPOSE: Import a space time vector dataset 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: Imports a space time vector dataset from a GRASS GIS specific archive file.
  18. #% keyword: temporal
  19. #% keyword: import
  20. #% keyword: vector
  21. #% keyword: time
  22. #% keyword: create location
  23. #%end
  24. #%option G_OPT_F_INPUT
  25. #%end
  26. #%option G_OPT_STVDS_OUTPUT
  27. #%end
  28. #%option
  29. #% key: basename
  30. #% type: string
  31. #% label: Basename of the new generated output maps
  32. #% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
  33. #% required: no
  34. #% multiple: no
  35. #%end
  36. #%option G_OPT_M_DIR
  37. #% key: directory
  38. #% description: Path to the extraction directory
  39. #%end
  40. #%option
  41. #% key: title
  42. #% type: string
  43. #% description: Title of the new space time dataset
  44. #% required: no
  45. #% multiple: no
  46. #%end
  47. #%option
  48. #% key: description
  49. #% type: string
  50. #% description: Description of the new space time dataset
  51. #% required: no
  52. #% multiple: no
  53. #%end
  54. #%option
  55. #% key: location
  56. #% type: string
  57. #% description: Create a new location and import the data into it. Do not run this module in parallel or interrupt it when a new location should be created
  58. #% required: no
  59. #% multiple: no
  60. #%end
  61. #%flag
  62. #% key: e
  63. #% description: Extend location extents based on new dataset
  64. #%end
  65. #%flag
  66. #% key: o
  67. #% label: Override projection check (use current location's projection)
  68. #% description: Assume that the dataset has same projection as the current location
  69. #%end
  70. #%flag
  71. #% key: c
  72. #% description: Create the location specified by the "location" parameter and exit. Do not import the space time vector datasets.
  73. #%end
  74. import grass.script as grass
  75. def main():
  76. # lazy imports
  77. import grass.temporal as tgis
  78. # Get the options
  79. input = options["input"]
  80. output = options["output"]
  81. directory = options["directory"]
  82. title = options["title"]
  83. descr = options["description"]
  84. location = options["location"]
  85. base = options["basename"]
  86. exp = flags["e"]
  87. overr = flags["o"]
  88. create = flags["c"]
  89. tgis.init()
  90. tgis.import_stds(input, output, directory, title, descr, location,
  91. None, exp, overr, create, "stvds", base)
  92. if __name__ == "__main__":
  93. options, flags = grass.parser()
  94. main()