浏览代码

search maps, don't hardcode

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@35525 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 16 年之前
父节点
当前提交
fee3ffb319
共有 2 个文件被更改,包括 6 次插入3 次删除
  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]
 else:
   input = raw_input("Raster Map Name? ")
-mapset = 'PERMANENT'
 
 # initialize
 grasslib.G_gisinit('')
 
+# find map in search path
+mapset = grasslib.G_find_cell2(input,'')
+
 # determine the inputmap type (CELL/FCELL/DCELL) */
 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:
   input = raw_input("Vector Map Name? ")
 
-mapset = 'PERMANENT'
-
 # initialize
 grasslib.G_gisinit('')
 
+# find map in search path
+mapset = grasslib.G_find_vector2(input,'')
+
 # define map structure
 map = grassvect.Map_info()