v.what.vect.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 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: database
  19. #% keywords: attribute table
  20. #%end
  21. #%option G_OPT_V_MAP
  22. #%end
  23. #%option G_OPT_V_FIELD
  24. #%end
  25. #%option G_OPT_DB_COLUMN
  26. #% description: Name of attribute column to be updated with the query result
  27. #% required: yes
  28. #%end
  29. #%option G_OPT_V_MAP
  30. #% key: qmap
  31. #% description: Name of vector map to be queried
  32. #% required : yes
  33. #%end
  34. #%option G_OPT_V_FIELD
  35. #% key: qlayer
  36. #%end
  37. #%option G_OPT_DB_COLUMN
  38. #% key: qcolumn
  39. #% description: Name of attribute column to be queried
  40. #% required: yes
  41. #%end
  42. #%option
  43. #% key: dmax
  44. #% type: double
  45. #% description: Maximum query distance in map units
  46. #% answer: 0.0
  47. #% required: no
  48. #%end
  49. import sys
  50. from grass.script import core as grass
  51. def main():
  52. grass.exec_command(
  53. "v.distance",
  54. _from = options['map'],
  55. to = options['qmap'],
  56. column = options['column'],
  57. to_column = options['qcolumn'],
  58. upload = "to_attr",
  59. dmax = options['dmax'],
  60. from_layer = options['layer'],
  61. to_layer = options['qlayer'])
  62. if __name__ == "__main__":
  63. options, flags = grass.parser()
  64. main()