The GISDBASE is a directory with the structure used by GRASS GIS to store the data, it contain at least a LOCATION
from grass.pygrass.gis import Gisdbase
gisdb = Gisdbase()
gisdb.name
gisdb.locations()
The LOCATION is some geographic extent of interest that contains data sets that [should] all be in the same coordinate system.
from grass.pygrass.gis import Location
Location()
gisdb['loc_ncarolina_spm_base0.3.1']
northc = gisdb['loc_ncarolina_spm_base0.3.1']
northc.gisdbase
northc.name
northc.mapsets()
In a MAPSET you can organize GIS maps thematically or geographically or by project or whatever. Every GRASS session runs under the name of a MAPSET. A MAPSET may be a geographical subset or as large as the parent LOCATION.
from grass.pygrass.gis import Mapset
Mapset()
northc['user1']
# fails for simlink (on the live PERMANENT is a simlink to a different directory)
#
#permanent = northc['PERMANENT']
northc = northc['user1']
northc.gisdbase
northc.location
northc.name
northc.glist('raster')
%timeit Mapset('user1').glist('raster')
from grass.script import core as gcore
gcore.list_grouped('rast')['user1']
%timeit gcore.list_grouped('rast')['user1']
Mapset('user1').glist('raster', pattern='el*')
The REGION may be the entire area or subset of the chosen LOCATION. It is defined by northern, southern, eastern, and western bounds, as well as the raster grid resolution. It is controlled by the g.region module and is of primary importance for raster operations
from grass.pygrass.gis.region import Region
reg = Region()
reg
reg.items()
reg.north
reg.ewres
reg.get_bbox()
#!g.region --help
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-51-85994cec4f56> in <module>()
----> 1 with Region(nsres=100., ewres=100.) as region:
2 print(region.items())
3 print(Region().items())
TypeError: __init__() got an unexpected keyword argument 'nsres'
Region.nsres=100.
Region.ewres=100.
Region()
Is a element of pygrass to create a Bounding Box, it use a GRASS GIS C structure
from grass.pygrass.vector.basic import Bbox
from grass.pygrass.vector.geometry import Point
bbox = Bbox()
bbox
bbox.north = 10
bbox.east = 10
point = Point(5, 5)
bbox.contains(point)
We have seen: