v.what.vect.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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, database, attribute table
  18. #%End
  19. #%option
  20. #% key: vector
  21. #% type: string
  22. #% key_desc: name
  23. #% gisprompt: old,vector,vector
  24. #% description: Points vector map to modify
  25. #% required : yes
  26. #%end
  27. #%option
  28. #% key: layer
  29. #% type: integer
  30. #% description: Layer in the vector to be modified
  31. #% answer: 1
  32. #% required : no
  33. #%end
  34. #%option
  35. #% key: column
  36. #% type: string
  37. #% description: Column to be updated with the query result
  38. #% required : yes
  39. #%end
  40. #%option
  41. #% key: qvector
  42. #% type: string
  43. #% key_desc: name
  44. #% gisprompt: old,vector,vector
  45. #% description: Vector map to be queried
  46. #% required : yes
  47. #%end
  48. #%option
  49. #% key: qlayer
  50. #% type: integer
  51. #% description: Layer of the query vector containg data
  52. #% answer: 1
  53. #% required : no
  54. #%end
  55. #%option
  56. #% key: qcolumn
  57. #% type: string
  58. #% description: Column to be queried
  59. #% required : yes
  60. #%end
  61. #%option
  62. #% key: dmax
  63. #% type: double
  64. #% description: Maximum query distance in map units
  65. #% answer: 0.0
  66. #% required: no
  67. #%end
  68. import sys
  69. import grass
  70. def main():
  71. grass.exec_command(
  72. "v.distance",
  73. fro = options['vector'],
  74. to = options['qvector'],
  75. column = options['column'],
  76. to_column = options['qcolumn'],
  77. upload = to_attr,
  78. dmax = options['dmax'],
  79. from_layer = options['layer'],
  80. to_layer = options['qlayer '])
  81. if __name__ == "__main__":
  82. options, flags = grass.parser()
  83. main()