t.vect.import.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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-2017 by the GRASS Development Team
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version.
  15. #
  16. # This program is distributed in the hope that it will be useful,
  17. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. # GNU General Public License for more details.
  20. #
  21. #############################################################################
  22. #%module
  23. #% description: Imports a space time vector dataset from a GRASS GIS specific archive file.
  24. #% keyword: temporal
  25. #% keyword: import
  26. #% keyword: vector
  27. #% keyword: time
  28. #% keyword: create location
  29. #%end
  30. #%option G_OPT_F_INPUT
  31. #%end
  32. #%option G_OPT_STVDS_OUTPUT
  33. #%end
  34. #%option
  35. #% key: basename
  36. #% type: string
  37. #% label: Basename of the new generated output maps
  38. #% description: A numerical suffix separated by an underscore will be attached to create a unique identifier
  39. #% required: no
  40. #% multiple: no
  41. #%end
  42. #%option G_OPT_M_DIR
  43. #% key: directory
  44. #% description: Path to the extraction directory
  45. #%end
  46. #%option
  47. #% key: title
  48. #% type: string
  49. #% description: Title of the new space time dataset
  50. #% required: no
  51. #% multiple: no
  52. #%end
  53. #%option
  54. #% key: description
  55. #% type: string
  56. #% description: Description of the new space time dataset
  57. #% required: no
  58. #% multiple: no
  59. #%end
  60. #%option
  61. #% key: location
  62. #% type: string
  63. #% 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
  64. #% required: no
  65. #% multiple: no
  66. #%end
  67. #%flag
  68. #% key: e
  69. #% description: Extend location extents based on new dataset
  70. #%end
  71. #%flag
  72. #% key: o
  73. #% label: Override projection check (use current location's projection)
  74. #% description: Assume that the dataset has same projection as the current location
  75. #%end
  76. #%flag
  77. #% key: c
  78. #% description: Create the location specified by the "location" parameter and exit. Do not import the space time vector datasets.
  79. #%end
  80. import grass.script as grass
  81. def main():
  82. # lazy imports
  83. import grass.temporal as tgis
  84. # Get the options
  85. input = options["input"]
  86. output = options["output"]
  87. directory = options["directory"]
  88. title = options["title"]
  89. descr = options["description"]
  90. location = options["location"]
  91. base = options["basename"]
  92. exp = flags["e"]
  93. overr = flags["o"]
  94. create = flags["c"]
  95. tgis.init()
  96. tgis.import_stds(input, output, directory, title, descr, location,
  97. None, exp, overr, create, "stvds", base)
  98. if __name__ == "__main__":
  99. options, flags = grass.parser()
  100. main()