Browse Source

search maps, don't hardcode

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@35525 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 16 years ago
parent
commit
fee3ffb319
2 changed files with 6 additions and 3 deletions
  1. 3 1
      swig/python/examples/rasteraccess.py
  2. 3 2
      swig/python/examples/vectoraccess.py

+ 3 - 1
swig/python/examples/rasteraccess.py

@@ -14,11 +14,13 @@ if len(sys.argv)==2:
   input = sys.argv[1]
   input = sys.argv[1]
 else:
 else:
   input = raw_input("Raster Map Name? ")
   input = raw_input("Raster Map Name? ")
-mapset = 'PERMANENT'
 
 
 # initialize
 # initialize
 grasslib.G_gisinit('')
 grasslib.G_gisinit('')
 
 
+# find map in search path
+mapset = grasslib.G_find_cell2(input,'')
+
 # determine the inputmap type (CELL/FCELL/DCELL) */
 # determine the inputmap type (CELL/FCELL/DCELL) */
 data_type = grasslib.G_raster_map_type(input, mapset)
 data_type = grasslib.G_raster_map_type(input, mapset)
 
 

+ 3 - 2
swig/python/examples/vectoraccess.py

@@ -15,11 +15,12 @@ if len(sys.argv)==2:
 else:
 else:
   input = raw_input("Vector Map Name? ")
   input = raw_input("Vector Map Name? ")
 
 
-mapset = 'PERMANENT'
-
 # initialize
 # initialize
 grasslib.G_gisinit('')
 grasslib.G_gisinit('')
 
 
+# find map in search path
+mapset = grasslib.G_find_vector2(input,'')
+
 # define map structure
 # define map structure
 map = grassvect.Map_info()
 map = grassvect.Map_info()