t.vect.import.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 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: Import a space time vector dataset archive file
  18. #% keywords: temporal
  19. #% keywords: import
  20. #%end
  21. #%option G_OPT_F_INPUT
  22. #%end
  23. #%option G_OPT_STVDS_OUTPUT
  24. #%end
  25. #%option G_OPT_M_DIR
  26. #% key: extrdir
  27. #% description: Path to the extraction directory
  28. #%end
  29. #%option
  30. #% key: title
  31. #% type: string
  32. #% description: Title of the new space time dataset
  33. #% required: no
  34. #% multiple: no
  35. #%end
  36. #%option
  37. #% key: description
  38. #% type: string
  39. #% description: Description of the new space time dataset
  40. #% required: no
  41. #% multiple: no
  42. #%end
  43. #%option
  44. #% key: location
  45. #% type: string
  46. #% description: Create a new location and import the data into it. Please do not run this module in parallel or interrupt it when a new location should be created.
  47. #% required: no
  48. #% multiple: no
  49. #%end
  50. #%flag
  51. #% key: e
  52. #% description: Extend location extents based on new dataset
  53. #%end
  54. #%flag
  55. #% key: o
  56. #% description: Override projection (use location's projection)
  57. #%end
  58. #%flag
  59. #% key: c
  60. #% description: Create the location specified by the "location" parameter and exit. Do not import the space time vector datasets.
  61. #%end
  62. import grass.script as grass
  63. import grass.temporal as tgis
  64. def main():
  65. # Get the options
  66. input = options["input"]
  67. output = options["output"]
  68. extrdir = options["extrdir"]
  69. title = options["title"]
  70. descr = options["description"]
  71. location = options["location"]
  72. exp = flags["e"]
  73. overr = flags["o"]
  74. create = flags["c"]
  75. tgis.init()
  76. tgis.import_stds(input, output, extrdir, title, descr, location,
  77. None, exp, overr, create, "stvds")
  78. if __name__ == "__main__":
  79. options, flags = grass.parser()
  80. main()