Skip to content

r.in.poly

Creates raster maps from ASCII polygon/line/point data files.

r.in.poly input=name output=name [title=phrase] [type=string] [null=integer] [rows=integer] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.in.poly input=name output=name

grass.script.run_command("r.in.poly", input, output, title=None, type="CELL", null=None, rows=4096, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r.in.poly", input="name", output="name")

Parameters

input=name [required]
    Name of input file; or "-" to read from stdin
output=name [required]
    Name for output raster map
title=phrase
    Title for resultant raster map
type=string
    Type of raster map to be created
    Storage type for resultant raster map
    Allowed values: CELL, FCELL, DCELL
    Default: CELL
    CELL: Integer
    FCELL: Single precision floating point
    DCELL: Double precision floating point
null=integer
    Integer representing NULL value data cell
rows=integer
    Number of rows to hold in memory
    Default: 4096
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Name of input file; or "-" to read from stdin
    Used as: input, file, name
output : str, required
    Name for output raster map
    Used as: output, raster, name
title : str, optional
    Title for resultant raster map
    Used as: phrase
type : str, optional
    Type of raster map to be created
    Storage type for resultant raster map
    Allowed values: CELL, FCELL, DCELL
    CELL: Integer
    FCELL: Single precision floating point
    DCELL: Double precision floating point
    Default: CELL
null : int, optional
    Integer representing NULL value data cell
rows : int, optional
    Number of rows to hold in memory
    Default: 4096
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

r.in.poly allows the creation of GRASS binary raster maps from ASCII files in the current directory containing polygon, linear, and point features.

The input file is an ASCII text file containing the polygon, linear, and point feature definitions. The format of this file is described in the INPUT FORMAT section below.

The number of raster rows to hold in memory is per default 4096. This parameter allows users with less memory (or more) on their system to control how much memory r.in.poly uses. Usually the default value is fine.

NOTES

The data will be imported using the current region settings to set the new raster map's bounds and resolution. Any features falling outside the current region will be cropped. The region settings are controlled with the g.region module.

The format is a simplified version of the standard GRASS vector ASCII format used by v.in.ascii.

Polygons are filled, i.e. they define an area.

Input Format

The input format for the input file consists of sections describing either polygonal areas, linear features, or point features. The basic format is:

A                      <for polygonal areas>
    easting northing
    .
    .
    .
=   cat# label
L                      <for linear features>
    easting northing
    .
    .
    .
=   cat# label
P                      <for single cell point features>
    easting northing
=   cat# label

The A signals the beginning of a filled polygon. It must appear in the first column. The L signals the beginning of a linear feature. It also must appear in the first column. The P signals the beginning of a single cell point feature. Again, it must appear in the first column. The coordinates of the vertices of the polygon, or the coordinates defining the linear or point feature follow and must have a space in the first column and at least one space between the easting and the northing. To give meaning to the features, the "=" indicates that the feature currently being processed has category value cat# (which must be an integer) and a label (which may be more than one word, or which may be omitted).

EXAMPLE

An area described by four points:

A
  591316.80   4926455.50
  591410.25   4926482.40
  591434.60   4926393.60
  591341.20   4926368.70
= 42 stadium

SEE ALSO

r.colors, d.rast.edit, g.region, r.in.xyz, r.patch, v.in.ascii, wxGUI vector digitizer

AUTHOR

Michael Shapiro, U.S.Army Construction Engineering Research Laboratory

SOURCE CODE

Available at: r.in.poly source code (history)
Latest change: Friday Mar 07 07:39:48 2025 in commit e1e37d8