grass.pygrass package — GRASS Python Library documentation

# grass.pygrass package

## Subpackages

- grass.pygrass.gis package
  - `Gisdbase`
    - `Gisdbase.locations()`
    - `Gisdbase.name`
    - `Gisdbase.new_location()`
  - `Location`
    - `Location.gisdbase`
    - `Location.mapsets()`
    - `Location.name`
    - `Location.path()`
  - `Mapset`
    - `Mapset.current()`
    - `Mapset.delete()`
    - `Mapset.gisdbase`
    - `Mapset.glist()`
    - `Mapset.is_current()`
    - `Mapset.location`
    - `Mapset.name`
    - `Mapset.path()`
  - `VisibleMapset`
    - `VisibleMapset.add()`
    - `VisibleMapset.extend()`
    - `VisibleMapset.read()`
    - `VisibleMapset.remove()`
    - `VisibleMapset.reset()`
  - `is_valid()`
  - `make_mapset()`
  - `set_current_mapset()`
  - Submodules
  - grass.pygrass.gis.region module
    - `Region`
      - `Region.adjust()`
      - `Region.align()`
      - `Region.bottom`
      - `Region.byref()`
      - `Region.cells`
      - `Region.cols`
      - `Region.depths`
      - `Region.east`
      - `Region.ewres`
      - `Region.from_rast()`
      - `Region.from_vect()`
      - `Region.get_bbox()`
      - `Region.get_current()`
      - `Region.items()`
      - `Region.keys()`
      - `Region.north`
      - `Region.nsres`
      - `Region.proj`
      - `Region.read()`
      - `Region.read_default()`
      - `Region.rows`
      - `Region.set_bbox()`
      - `Region.set_current()`
      - `Region.set_raster_region()`
      - `Region.south`
      - `Region.tbres`
      - `Region.top`
      - `Region.west`
      - `Region.write()`
      - `Region.zone`
      - `Region.zoom()`
- grass.pygrass.messages package
  - `Messenger`
    - `Messenger.debug()`
    - `Messenger.error()`
    - `Messenger.fatal()`
    - `Messenger.get_raise_on_error()`
    - `Messenger.important()`
    - `Messenger.message()`
    - `Messenger.percent()`
    - `Messenger.set_raise_on_error()`
    - `Messenger.start_server()`
    - `Messenger.stop()`
    - `Messenger.test_fatal_error()`
    - `Messenger.verbose()`
    - `Messenger.warning()`
  - `get_msgr()`
  - `message_server()`
- grass.pygrass.modules package
  - Subpackages
    - grass.pygrass.modules.grid package
      - Submodules
      - grass.pygrass.modules.grid.grid module
      - grass.pygrass.modules.grid.patch module
      - grass.pygrass.modules.grid.split module
    - grass.pygrass.modules.interface package
      - Submodules
      - grass.pygrass.modules.interface.docstring module
      - grass.pygrass.modules.interface.env module
      - grass.pygrass.modules.interface.flag module
      - grass.pygrass.modules.interface.module module
      - grass.pygrass.modules.interface.parameter module
      - grass.pygrass.modules.interface.read module
      - grass.pygrass.modules.interface.typedict module
  - Submodules
  - grass.pygrass.modules.shortcuts module
    - `MetaModule`
- grass.pygrass.raster package
  - `RasterRow`
    - `RasterRow.get_row()`
    - `RasterRow.open()`
    - `RasterRow.put_row()`
  - `RasterRowIO`
    - `RasterRowIO.close()`
    - `RasterRowIO.get_row()`
    - `RasterRowIO.open()`
  - `RasterSegment`
    - `RasterSegment.close()`
    - `RasterSegment.get()`
    - `RasterSegment.get_row()`
    - `RasterSegment.map2segment()`
    - `RasterSegment.mode`
    - `RasterSegment.open()`
    - `RasterSegment.put()`
    - `RasterSegment.put_row()`
    - `RasterSegment.segment2map()`
  - `numpy2raster()`
  - `random_map()`
  - `random_map_only_columns()`
  - `raster2numpy()`
  - `raster2numpy_img()`
  - Submodules
  - grass.pygrass.raster.abstract module
    - `Info`
      - `Info.bottom`
      - `Info.cols`
      - `Info.east`
      - `Info.ewres`
      - `Info.items()`
      - `Info.keys()`
      - `Info.max`
      - `Info.min`
      - `Info.mtype`
      - `Info.north`
      - `Info.nsres`
      - `Info.proj`
      - `Info.range`
      - `Info.read()`
      - `Info.rows`
      - `Info.semantic_label`
      - `Info.south`
      - `Info.tbres`
      - `Info.top`
      - `Info.units`
      - `Info.vdatum`
      - `Info.west`
      - `Info.zone`
    - `RasterAbstractBase`
      - `RasterAbstractBase.cats_title`
      - `RasterAbstractBase.close()`
      - `RasterAbstractBase.copy_cats()`
      - `RasterAbstractBase.exist()`
      - `RasterAbstractBase.fullname()`
      - `RasterAbstractBase.get_cat()`
      - `RasterAbstractBase.get_cats()`
      - `RasterAbstractBase.get_value()`
      - `RasterAbstractBase.has_cats()`
      - `RasterAbstractBase.is_open()`
      - `RasterAbstractBase.mode`
      - `RasterAbstractBase.mtype`
      - `RasterAbstractBase.name`
      - `RasterAbstractBase.name_mapset()`
      - `RasterAbstractBase.num_cats()`
      - `RasterAbstractBase.overwrite`
      - `RasterAbstractBase.read_cats()`
      - `RasterAbstractBase.read_cats_rules()`
      - `RasterAbstractBase.remove()`
      - `RasterAbstractBase.rename()`
      - `RasterAbstractBase.set_cat()`
      - `RasterAbstractBase.set_cats()`
      - `RasterAbstractBase.set_region()`
      - `RasterAbstractBase.set_region_from_rast()`
      - `RasterAbstractBase.sort_cats()`
      - `RasterAbstractBase.write_cats()`
      - `RasterAbstractBase.write_cats_rules()`
  - grass.pygrass.raster.buffer module
    - `Buffer`
      - `Buffer.mtype`
  - grass.pygrass.raster.category module
    - `Category`
      - `Category.copy()`
      - `Category.get_cat()`
      - `Category.labels()`
      - `Category.mtype`
      - `Category.ncats()`
      - `Category.read()`
      - `Category.read_rules()`
      - `Category.reset()`
      - `Category.set_cat()`
      - `Category.set_cats_fmt()`
      - `Category.sort()`
      - `Category.title`
      - `Category.write()`
      - `Category.write_rules()`
  - grass.pygrass.raster.history module
    - `History`
      - `History.append()`
      - `History.append_fmt()`
      - `History.clear()`
      - `History.command()`
      - `History.creator`
      - `History.date`
      - `History.format()`
      - `History.keyword`
      - `History.length()`
      - `History.line()`
      - `History.mapset`
      - `History.maptype`
      - `History.read()`
      - `History.short()`
      - `History.src1`
      - `History.src2`
      - `History.title`
      - `History.write()`
  - grass.pygrass.raster.raster_type module
  - grass.pygrass.raster.rowio module
    - `RowIO`
      - `RowIO.get()`
      - `RowIO.open()`
      - `RowIO.release()`
    - `getmaprow_CELL()`
    - `getmaprow_DCELL()`
    - `getmaprow_FCELL()`
  - grass.pygrass.raster.segment module
    - `Segment`
      - `Segment.close()`
      - `Segment.cols()`
      - `Segment.flush()`
      - `Segment.format()`
      - `Segment.get()`
      - `Segment.get_row()`
      - `Segment.get_seg_number()`
      - `Segment.init()`
      - `Segment.nseg()`
      - `Segment.open()`
      - `Segment.put()`
      - `Segment.put_row()`
      - `Segment.release()`
      - `Segment.rows()`
      - `Segment.segments_in_mem()`
- grass.pygrass.rpc package
  - `DataProvider`
    - `DataProvider.get_raster_image_as_np()`
    - `DataProvider.get_vector_features_as_wkb_list()`
    - `DataProvider.get_vector_table_as_dict()`
    - `DataProvider.start_server()`
  - `RPCDefs`
    - `RPCDefs.GET_RASTER_IMAGE_AS_NP`
    - `RPCDefs.GET_VECTOR_FEATURES_AS_WKB`
    - `RPCDefs.GET_VECTOR_TABLE_AS_DICT`
    - `RPCDefs.G_FATAL_ERROR`
    - `RPCDefs.STOP`
  - `data_provider_server()`
  - Submodules
  - grass.pygrass.rpc.base module
    - `RPCServerBase`
      - `RPCServerBase.check_server()`
      - `RPCServerBase.is_check_thread_alive()`
      - `RPCServerBase.is_server_alive()`
      - `RPCServerBase.safe_receive()`
      - `RPCServerBase.start_checker_thread()`
      - `RPCServerBase.start_server()`
      - `RPCServerBase.stop()`
      - `RPCServerBase.stop_checker_thread()`
      - `RPCServerBase.thread_checker()`
    - `dummy_server()`
- grass.pygrass.shell package
  - Submodules
  - grass.pygrass.shell.conversion module
    - `dict2html()`
  - grass.pygrass.shell.show module
    - `raw_figure()`
- grass.pygrass.tests package
  - Submodules
  - grass.pygrass.tests.benchmark module
    - `OptionParser`
      - `OptionParser.check_values()`
    - `OptionWithDefault`
      - `OptionWithDefault.ATTRS`
    - `get_testdict()`
    - `get_testlist()`
    - `get_txt()`
    - `main()`
    - `mytimer()`
    - `print_test()`
    - `run_benchmark()`
    - `test__RasterRowIO_row_access__add()`
    - `test__RasterRowIO_row_access__if()`
    - `test__RasterRow_row_access__add()`
    - `test__RasterRow_row_access__if()`
    - `test__RasterRow_value_access__add()`
    - `test__RasterRow_value_access__if()`
    - `test__RasterSegment_row_access__add()`
    - `test__RasterSegment_row_access__if()`
    - `test__RasterSegment_value_access__add()`
    - `test__RasterSegment_value_access__if()`
    - `test__mapcalc__add()`
    - `test__mapcalc__if()`
  - grass.pygrass.tests.set_mapset module
    - `main()`
    - `read_gisrc()`
- grass.pygrass.vector package
  - `Vector`
    - `Vector.has_color_table()`
    - `Vector.next()`
    - `Vector.rewind()`
    - `Vector.write()`
  - `VectorTopo`
    - `VectorTopo.areas_to_wkb_list()`
    - `VectorTopo.bbox()`
    - `VectorTopo.cat()`
    - `VectorTopo.close()`
    - `VectorTopo.delete()`
    - `VectorTopo.features_to_wkb_list()`
    - `VectorTopo.is_empty()`
    - `VectorTopo.num_primitive_of()`
    - `VectorTopo.num_primitives()`
    - `VectorTopo.number_of()`
    - `VectorTopo.read()`
    - `VectorTopo.restore()`
    - `VectorTopo.rewind()`
    - `VectorTopo.rewrite()`
    - `VectorTopo.table_to_dict()`
    - `VectorTopo.viter()`
  - Submodules
  - grass.pygrass.vector.abstract module
    - `Info`
      - `Info.build()`
      - `Info.close()`
      - `Info.comment`
      - `Info.date`
      - `Info.exist()`
      - `Info.full_name`
      - `Info.is_3D()`
      - `Info.is_open()`
      - `Info.map_date`
      - `Info.mapset`
      - `Info.maptype`
      - `Info.mode`
      - `Info.name`
      - `Info.open()`
      - `Info.organization`
      - `Info.person`
      - `Info.proj`
      - `Info.proj_name`
      - `Info.remove()`
      - `Info.rename()`
      - `Info.scale`
      - `Info.thresh`
      - `Info.title`
      - `Info.write_header()`
      - `Info.zone`
    - `is_open()`
  - grass.pygrass.vector.basic module
    - `Bbox`
      - `Bbox.bottom`
      - `Bbox.contains()`
      - `Bbox.east`
      - `Bbox.items()`
      - `Bbox.keys()`
      - `Bbox.north`
      - `Bbox.nsewtb()`
      - `Bbox.south`
      - `Bbox.top`
      - `Bbox.west`
    - `BoxList`
      - `BoxList.append()`
      - `BoxList.have_boxes()`
      - `BoxList.ids`
      - `BoxList.n_values`
      - `BoxList.remove()`
      - `BoxList.reset()`
    - `Cats`
      - `Cats.cat`
      - `Cats.check_cats_constraints()`
      - `Cats.delete()`
      - `Cats.get()`
      - `Cats.get_list()`
      - `Cats.layer`
      - `Cats.n_cats`
      - `Cats.reset()`
      - `Cats.set()`
    - `CatsList`
      - `CatsList.from_array()`
      - `CatsList.from_string()`
      - `CatsList.layer`
      - `CatsList.max`
      - `CatsList.min`
      - `CatsList.n_ranges`
    - `Ilist`
      - `Ilist.append()`
      - `Ilist.contains()`
      - `Ilist.extend()`
      - `Ilist.remove()`
      - `Ilist.reset()`
  - grass.pygrass.vector.find module
    - `AbstractFinder`
      - `AbstractFinder.is_open()`
    - `BboxFinder`
      - `BboxFinder.areas()`
      - `BboxFinder.geos()`
      - `BboxFinder.islands()`
      - `BboxFinder.nodes()`
    - `PointFinder`
      - `PointFinder.area()`
      - `PointFinder.geo()`
      - `PointFinder.geos()`
      - `PointFinder.island()`
      - `PointFinder.node()`
    - `PolygonFinder`
      - `PolygonFinder.areas()`
      - `PolygonFinder.lines()`
  - grass.pygrass.vector.geometry module
    - `Area`
      - `Area.alive()`
      - `Area.area()`
      - `Area.bbox()`
      - `Area.boundaries()`
      - `Area.buffer()`
      - `Area.cat`
      - `Area.cats()`
      - `Area.centroid()`
      - `Area.contains_point()`
      - `Area.get_first_cat()`
      - `Area.gtype`
      - `Area.isles()`
      - `Area.num_isles()`
      - `Area.perimeter()`
      - `Area.points()`
      - `Area.read()`
      - `Area.to_wkb()`
      - `Area.to_wkt()`
    - `Attrs`
      - `Attrs.cat`
      - `Attrs.commit()`
      - `Attrs.keys()`
      - `Attrs.values()`
    - `Boundary`
      - `Boundary.area()`
      - `Boundary.gtype`
      - `Boundary.left_area_id`
      - `Boundary.left_centroid()`
      - `Boundary.read_area_ids()`
      - `Boundary.right_area_id`
      - `Boundary.right_centroid()`
    - `Centroid`
      - `Centroid.gtype`
    - `Geo`
      - `Geo.cat`
      - `Geo.gtype`
      - `Geo.has_topology()`
      - `Geo.read()`
      - `Geo.to_wkb()`
      - `Geo.to_wkt()`
    - `Isle`
      - `Isle.alive()`
      - `Isle.area()`
      - `Isle.area_id()`
      - `Isle.bbox()`
      - `Isle.boundaries()`
      - `Isle.contain_pnt()`
      - `Isle.perimeter()`
      - `Isle.points()`
      - `Isle.points_geos()`
      - `Isle.to_wkb()`
      - `Isle.to_wkt()`
    - `Isles`
      - `Isles.isles()`
      - `Isles.isles_ids()`
    - `Line`
      - `Line.alive()`
      - `Line.append()`
      - `Line.bbox()`
      - `Line.buffer()`
      - `Line.delete()`
      - `Line.distance()`
      - `Line.extend()`
      - `Line.first_cat()`
      - `Line.from_wkt()`
      - `Line.gtype`
      - `Line.insert()`
      - `Line.length()`
      - `Line.length_geodesic()`
      - `Line.nodes()`
      - `Line.point_on_line()`
      - `Line.pop()`
      - `Line.prune()`
      - `Line.prune_thresh()`
      - `Line.remove()`
      - `Line.reset()`
      - `Line.reverse()`
      - `Line.segment()`
      - `Line.to_array()`
      - `Line.to_list()`
      - `Line.to_wkt_p()`
    - `LineDist`
      - `LineDist.dist`
      - `LineDist.point`
      - `LineDist.sldist`
      - `LineDist.spdist`
    - `Node`
      - `Node.alive()`
      - `Node.angles()`
      - `Node.coords()`
      - `Node.ilines()`
      - `Node.lines()`
      - `Node.to_wkb()`
      - `Node.to_wkt()`
    - `Point`
      - `Point.buffer()`
      - `Point.coords()`
      - `Point.distance()`
      - `Point.gtype`
      - `Point.to_wkt_p()`
      - `Point.x`
      - `Point.y`
      - `Point.z`
    - `c_read_line()`
    - `c_read_next_line()`
    - `get_xyz()`
    - `intersects()`
    - `read_WKB()`
    - `read_WKT()`
    - `read_line()`
    - `read_next_line()`
  - grass.pygrass.vector.sql module
  - grass.pygrass.vector.table module
    - `Columns`
      - `Columns.add()`
      - `Columns.cast()`
      - `Columns.drop()`
      - `Columns.is_pg()`
      - `Columns.items()`
      - `Columns.names()`
      - `Columns.rename()`
      - `Columns.sql_descr()`
      - `Columns.types()`
      - `Columns.update_odict()`
    - `DBlinks`
      - `DBlinks.add()`
      - `DBlinks.by_index()`
      - `DBlinks.by_layer()`
      - `DBlinks.by_name()`
      - `DBlinks.from_name_to_num()`
      - `DBlinks.num_dblinks()`
      - `DBlinks.remove()`
    - `Filters`
      - `Filters.get_sql()`
      - `Filters.group_by()`
      - `Filters.limit()`
      - `Filters.order_by()`
      - `Filters.reset()`
      - `Filters.select()`
      - `Filters.where()`
    - `Link`
      - `Link.connection()`
      - `Link.database`
      - `Link.driver`
      - `Link.info()`
      - `Link.key`
      - `Link.layer`
      - `Link.name`
      - `Link.table()`
      - `Link.table_name`
    - `Table`
      - `Table.create()`
      - `Table.drop()`
      - `Table.execute()`
      - `Table.exist()`
      - `Table.insert()`
      - `Table.n_rows()`
      - `Table.name`
      - `Table.update()`
    - `get_path()`
  - grass.pygrass.vector.vector_type module

## Submodules

## grass.pygrass.errors module

grass.pygrass.errors.mapinfo_must_be_set(method)

grass.pygrass.errors.must_be_in_current_mapset(method)

grass.pygrass.errors.must_be_open(method)

## grass.pygrass.utils module

grass.pygrass.utils.coor2pixel(coord, region)

  Convert coordinates into a pixel row and col

      >>> from grass.pygrass.gis.region import Region
      >>> reg = Region()
      >>> coor2pixel((reg.west, reg.north), reg)
      (0.0, 0.0)
      >>> coor2pixel((reg.east, reg.south), reg) == (reg.rows, reg.cols)
      True

grass.pygrass.utils.copy(existingmap, newmap, maptype, **kwargs)

  Copy a map

      >>> copy(test_vector_name, "mycensus", "vector")
      >>> rename("mycensus", "mynewcensus", "vector")
      >>> remove("mynewcensus", "vector")

grass.pygrass.utils.create_test_stream_network_map(map_name='streams')

  Create test data

  > This functions creates a vector map layer with lines that represent a stream network with two different graphs. The first graph contains a loop, the second can be used as directed graph.

  > This should be used in doc and unit tests to create location/mapset independent vector map layer.

  > > param map_name: The vector map name that should be used

  > 1(0,2) 3(2,2)

  >   /

  > 1 / 2
  >   /

  >     2(1,1)

  6(0,1) || 5(2,1)
    5 || / 4
      ||/

        4(1,0) | | 6 |7(1,-1)

    7(0,-1) 8(2,-1)

      /

    8 / 9
      /

        9(1, -2) | | 10 |

      10(1,-3)

grass.pygrass.utils.create_test_vector_map(map_name='test_vector')

  This functions creates a vector map layer with points, lines, boundaries, centroids, areas, isles and attributes for testing purposes

  This should be used in doc and unit tests to create location/mapset independent vector map layer. This map includes 3 points, 3 lines, 11 boundaries and 4 centroids. The attribute table contains cat, name and value columns.

  > param map_name: The vector map name that should be used

  > > > P1 P2 P3

  > > 6 * * * 5 4 _______ ___ ___ L1 L2 L3

  > Y 3 |A1___ *| *| *| | | |

  >   > 2 | |A2*| | | | | | | 1 | |___| |A3 |A4 | | | | 0 |_______|___|___| | | |

  >   `-1`
  >     -1 0 1 2 3 4 5 6 7 8 9 10 12 14

  >       X

grass.pygrass.utils.decode(obj, encoding=None)

  Decode string coming from c functions, can be ctypes class String, bytes, or None

grass.pygrass.utils.findfiles(dirpath, match=None)

  Return a list of the files

grass.pygrass.utils.findmaps(type, pattern=None, mapset='', location='', gisdbase='')

  Return a list of tuple contining the names of the:

  - map

  - mapset,

  - location,

  - gisdbase

grass.pygrass.utils.get_lib_path(modname, libname=None)

  Return the path of the libname contained in the module.

  Deprecated since version 7.1: Use `grass.script.utils.get_lib_path()` instead.

grass.pygrass.utils.get_mapset_raster(mapname, mapset='')

  Return the mapset of the raster map

      >>> get_mapset_raster(test_raster_name) == getenv("MAPSET")
      True

grass.pygrass.utils.get_mapset_vector(mapname, mapset='')

  Return the mapset of the vector map

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

grass.pygrass.utils.get_raster_for_points(poi_vector, raster, column=None, region=None)

  Query a raster map for each point feature of a vector

  Example

      >>> from grass.pygrass.raster import RasterRow
      >>> from grass.pygrass.gis.region import Region
      >>> from grass.pygrass.vector import VectorTopo
      >>> from grass.pygrass.vector.geometry import Point

  Create a vector map

      >>> cols = [("cat", "INTEGER PRIMARY KEY"), ("value", "double precision")]
      >>> vect = VectorTopo("test_vect_2")
      >>> vect.open("w", tab_name="test_vect_2", tab_cols=cols)
      >>> vect.write(
      ...     Point(10, 6),
      ...     cat=1,
      ...     attrs=[
      ...         10,
      ...     ],
      ... )
      >>> vect.write(
      ...     Point(12, 6),
      ...     cat=2,
      ...     attrs=[
      ...         12,
      ...     ],
      ... )
      >>> vect.write(
      ...     Point(14, 6),
      ...     cat=3,
      ...     attrs=[
      ...         14,
      ...     ],
      ... )
      >>> vect.table.conn.commit()
      >>> vect.close()

  Setup the raster sampling

      >>> region = Region()
      >>> region.from_rast(test_raster_name)
      >>> region.set_raster_region()
      >>> ele = RasterRow(test_raster_name)

  Sample the raster layer at the given points, return a list of values

      >>> l = get_raster_for_points(vect, ele, region=region)
      >>> l[0]
      (1, 10.0, 6.0, 1)
      >>> l[1]
      (2, 12.0, 6.0, 1)

  Add a new column and sample again

      >>> vect.open("r")
      >>> vect.table.columns.add(test_raster_name, "double precision")
      >>> vect.table.conn.commit()
      >>> test_raster_name in vect.table.columns
      True
      >>> get_raster_for_points(vect, ele, column=test_raster_name, region=region)
      True
      >>> vect.table.filters.select("value", test_raster_name)
      Filters('SELECT value, Utils_test_raster FROM test_vect_2;')
      >>> cur = vect.table.execute()
      >>> r = cur.fetchall()
      >>> r[0]
      (10.0, 1.0)
      >>> r[1]
      (12.0, 1.0)
      >>> remove("test_vect_2", "vect")

  Parameters:

    - poi_vector – A VectorTopo object that contains points

    - raster – raster object

    - column (str) – column name to update in the attrinute table, if set to None a list of sampled values will be returned

    - region – The region to work with, if not set the current computational region will be used

  Returns:

    True in case of success and a specified column for update, if column name for update was not set a list of (id, x, y, value) is returned

grass.pygrass.utils.getenv(env)

  Return the current grass environment variables

      >>> from grass.script.core import gisenv
      >>> getenv("MAPSET") == gisenv()["MAPSET"]
      True

grass.pygrass.utils.is_clean_name(name)

  Return if the name is valid

      >>> is_clean_name("census")
      True
      >>> is_clean_name("0census")
      True
      >>> is_clean_name("census?")
      True
      >>> is_clean_name("cénsus")
      False

grass.pygrass.utils.looking(obj, filter_string)

      >>> import grass.lib.vector as libvect
      >>> sorted(looking(libvect, "*by_box*"))
      ['Vect_select_areas_by_box', 'Vect_select_isles_by_box',
       'Vect_select_lines_by_box', 'Vect_select_nodes_by_box']

grass.pygrass.utils.pixel2coor(pixel, region)

  Convert row and col of a pixel into a coordinates

      >>> from grass.pygrass.gis.region import Region
      >>> reg = Region()
      >>> pixel2coor((0, 0), reg) == (reg.north, reg.west)
      True
      >>> pixel2coor((reg.cols, reg.rows), reg) == (reg.south, reg.east)
      True

grass.pygrass.utils.r_export(rast, output='', fmt='png', **kargs)

grass.pygrass.utils.remove(oldname, maptype)

  Remove a map

grass.pygrass.utils.rename(oldname, newname, maptype, **kwargs)

  Rename a map

grass.pygrass.utils.set_path(modulename, dirname=None, path='.')

  Set sys.path looking in the the local directory GRASS directories.

  Parameters:

    - modulename – string with the name of the GRASS module

    - dirname – string with the directory name containing the python libraries, default None

    - path – string with the path to reach the dirname locally.

  Deprecated since version 7.1: Use `grass.script.utils.set_path()` instead.

grass.pygrass.utils.split_in_chunk(iterable, length=10)

  Split a list in chunk.

      >>> for chunk in split_in_chunk(range(25)):
      ...     print(chunk)
      ...
      (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
      (10, 11, 12, 13, 14, 15, 16, 17, 18, 19)
      (20, 21, 22, 23, 24)
      >>> for chunk in split_in_chunk(range(25), 3):
      ...     print(chunk)
      ...
      (0, 1, 2)
      (3, 4, 5)
      (6, 7, 8)
      (9, 10, 11)
      (12, 13, 14)
      (15, 16, 17)
      (18, 19, 20)
      (21, 22, 23)
      (24,)

grass.pygrass.utils.table_exist(cursor, table_name)

  Return True if the table exist False otherwise

Help Index | Topics Index | Keywords Index | Full Index

© 2003-2026 GRASS Development Team, GRASS GIS 8.4.3dev Reference Manual