v.what.vect.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/usr/bin/env python
  2. #
  3. ############################################################################
  4. #
  5. # MODULE: v.what.vect
  6. # AUTHOR(S): Markus Neteler, converted to Python by Glynn Clements
  7. # PURPOSE: Uploads attributes at the location of vector points to the table.
  8. # COPYRIGHT: (C) 2005, 2008, 2011 by the GRASS Development Team
  9. #
  10. # This program is free software under the GNU General Public
  11. # License (>=v2). Read the file COPYING that comes with GRASS
  12. # for details.
  13. #
  14. #############################################################################
  15. #%module
  16. #% description: Uploads vector values at positions of vector points to the table.
  17. #% keywords: vector
  18. #% keywords: sampling
  19. #% keywords: database
  20. #% keywords: attribute table
  21. #%end
  22. #%option G_OPT_V_MAP
  23. #% label: Name of vector points map for which to edit attributes
  24. #%end
  25. #%option G_OPT_V_FIELD
  26. #%end
  27. #%option G_OPT_DB_COLUMN
  28. #% description: Name of attribute column to be updated with the query result
  29. #% required: yes
  30. #%end
  31. #%option G_OPT_V_MAP
  32. #% key: qmap
  33. #% label: Name of vector map to be queried
  34. #% required : yes
  35. #%end
  36. #%option G_OPT_V_FIELD
  37. #% key: qlayer
  38. #%end
  39. #%option G_OPT_DB_COLUMN
  40. #% key: qcolumn
  41. #% description: Name of attribute column to be queried
  42. #% required: yes
  43. #%end
  44. #%option
  45. #% key: dmax
  46. #% type: double
  47. #% description: Maximum query distance in map units
  48. #% answer: 0.0
  49. #% required: no
  50. #%end
  51. import sys
  52. from grass.script import core as grass
  53. def main():
  54. return grass.run_command("v.distance",
  55. _from = options['map'],
  56. to = options['qmap'],
  57. column = options['column'],
  58. to_column = options['qcolumn'],
  59. upload = "to_attr",
  60. dmax = options['dmax'],
  61. from_layer = options['layer'],
  62. to_layer = options['qlayer'])
  63. if __name__ == "__main__":
  64. options, flags = grass.parser()
  65. sys.exit(main())