In data giovedì 25 febbraio 2010 19:34:25, Luis Lisboa ha scritto:
: > Hi
> 
> I'm programming a few Scripts and I would like to know How can I access
> some global variables value such as GRASS_DIR, MAPSET; LOCATIOn or even
> others that I defined (e.g. GRASS_TEMP). How can I load and access them?
> (I'm working with Python scripts for GRASS 7)
> 
You could do something like:

---------------------------------
#!/usr/bin/python

import grass.script as grs

# get info about my location and mapset
env = grs.gisenv()
pathbase = env['GISDBASE']
location = env['LOCATION_NAME']
mapset = env['MAPSET']

# get absolut path to actually mapset
pathmapset=path.join(pathbase, location, mapset)

# get rasters
rasters=grs.list_grouped('rast')
# get vectors
vectors=grs.list_grouped('vect')

------------------------------------

may be there are something better...

Pietro
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to