Exemple #1
0
def get_mapset_vector(mapname, mapset=""):
    """Return the mapset of the vector map

    >>> get_mapset_vector(test_vector_name) == getenv("MAPSET")
    True

    """
    return decode(libgis.G_find_vector2(mapname, mapset))
Exemple #2
0
def get_mapset_vector(mapname, mapset=''):
    """Return the mapset of the vector map

    >>> get_mapset_vector('census')
    'PERMANENT'

    """
    return libgis.G_find_vector2(mapname, mapset)
    def curved(self):
        """Return"""
        mapset = GrassGis.G_find_vector2(self.nametin, "")
        if not mapset:
            sys.exit("Vector map <%s> not found" % self.nametin)

        # define map structure
        map_info = GrassGis.pointer(GrassVect.Map_info())

        # define open level (level 2: topology)
        GrassVect.Vect_set_open_level(2)

        # open existing vector map
        GrassVect.Vect_open_old(map_info, self.nametin, mapset)

        print("Calculating curves")

        allrectas = []
        rectas = self.get_rectas(map_info)

        for nivel in rectas:
            for recta in nivel:
                allrectas.append(recta)

        GrassVect.Vect_close(map_info)

        new = VectorTopo(self.namelines)
        new.open("w", with_z=True)

        for line in allrectas:
            new.write(Line(line))
        new.close()

        grass.run_command(
            "v.build.polylines",
            input=self.namelines,
            output=self.namecurved,
            overwrite=True,
            quiet=True,
        )