test.py 513 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env python
  2. # must be executed in the GRASS env
  3. # test case for Spearfish location
  4. import os, sys
  5. import grass
  6. if not os.environ.has_key("GISBASE"):
  7. print "You must be in GRASS GIS to run this program."
  8. sys.exit(1)
  9. rname = 'elevation.dem'
  10. mapset = 'PERMANENT'
  11. grass.G_gisinit('')
  12. grass.G_find_cell2(rname,'')
  13. print mapset
  14. print 'prints 0 if map was found'
  15. print 'roads:'
  16. print grass.G_raster_map_type('roads',mapset)
  17. print 'elevation.dem:'
  18. print grass.G_raster_map_type(rname,mapset)