Exemple #1
0
def set_current_mapset(mapset, location=None, gisdbase=None):
    """Set the current mapset as working area

    :param mapset: Name of the mapset
    :type value: str

    :param location: Name of the location
    :type location: str

    :param gisdbase: Name of the gisdbase
    :type gisdbase: str
    """
    libgis.G_setenv("MAPSET", mapset)
    if location:
        libgis.G_setenv("LOCATION_NAME", location)
    if gisdbase:
        libgis.G_setenv("GISDBASE", gisdbase)
Exemple #2
0
    def test_gisrc(self):
        # File access
        libgis.G_setenv("TEST", "A")

        value = libgis.G_getenv("TEST")
        self.assertEqual(value, "A")
        value = libgis.G_getenv2("TEST", libgis.G_VAR_GISRC)
        self.assertEqual(value, "A")

        # In memory management
        libgis.G_setenv_nogisrc("TEST", "B")

        value = libgis.G_getenv_nofatal("TEST")
        self.assertEqual(value, "B")
        value = libgis.G_getenv_nofatal2("TEST", libgis.G_VAR_GISRC)
        self.assertEqual(value, "B")
        # Force reading
        libgis.G__read_gisrc_env()
        value = libgis.G_getenv("TEST")
        self.assertEqual(value, "A")
        value = libgis.G_getenv2("TEST", libgis.G_VAR_GISRC)
        self.assertEqual(value, "A")