[GRASS-dev] [GRASS GIS] #3844: Make Region importable from pygrass.gis

GRASS GIS trac at osgeo.org
Sun May 12 02:51:28 PDT 2019


#3844: Make Region importable from pygrass.gis
-------------------------+-------------------------
 Reporter:  pmav99       |      Owner:  grass-dev@…
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  7.8.0
Component:  PyGRASS      |    Version:  svn-trunk
 Keywords:               |        CPU:  Unspecified
 Platform:  Unspecified  |
-------------------------+-------------------------
 Currently, in order to import the {{{Region}}} class you need to import it
 from {{{pygrass.gis.region}}}. The following patch allows to import it
 from the {{{pygrass.gis}}} package. This way, all gis objects can be
 imported/used from the same module. E.g.

 {{{
 import grass.pygrass.gis as ggis

 ggis.Region
 ggis.Location
 ggis.Mapset
 }}}

 The patch:
 {{{
 diff --git lib/python/pygrass/gis/__init__.py
 lib/python/pygrass/gis/__init__.py
 index 82e176bd..2e65e990 100644
 --- lib/python/pygrass/gis/__init__.py
 +++ lib/python/pygrass/gis/__init__.py
 @@ -9,11 +9,11 @@ import shutil
  import ctypes as ct
  import fnmatch

 -
  import grass.lib.gis as libgis
  from grass.pygrass.errors import GrassError
  from grass.script.utils import encode, decode
  from grass.pygrass.utils import getenv
 +from grass.pygrass.gis.region import Region

  test_vector_name = "Gis_test_vector"
  test_raster_name = "Gis_test_raster"
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3844>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list