Skip to content

v.extrude

Extrudes flat vector features to 3D vector features with defined height.

Optionally the height can be derived from sampling of elevation raster map.

v.extrude [-t] input=name [layer=string] [cats=range] [where=sql_query] [type=string [,string,...]] output=name [zshift=float] [height=float] [height_column=name] [elevation=name] [method=string] [scale=float] [null_value=float] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

v.extrude input=name output=name height=float

grass.script.run_command("v.extrude", input, layer="-1", cats=None, where=None, type="point,line,area", output, zshift=0, height=None, height_column=None, elevation=None, method="nearest", scale=1.0, null_value=None, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("v.extrude", input="name", output="name", height=float)

Parameters

input=name [required]
    Name of input vector map
    Or data source for direct OGR access
layer=string
    Layer number or name ('-1' for all layers)
    A single vector map can be connected to multiple database tables. This number determines which table to use. When used with direct OGR access this is the layer name.
    Default: -1
cats=range
    Category values
    Example: 1,3,7-9,13
where=sql_query
    WHERE conditions of SQL statement without 'where' keyword
    Example: income < 1000 and population >= 10000
type=string [,string,...]
    Input feature type
    Allowed values: point, line, area
    Default: point,line,area
output=name [required]
    Name for output vector map
zshift=float
    Shifting value for z coordinates
    Default: 0
height=float
    Fixed height for 3D vector features
height_column=name
    Name of attribute column with feature height
elevation=name
    Elevation raster map for height extraction
method=string
    Sampling interpolation method
    Allowed values: nearest, bilinear, bicubic
    Default: nearest
    nearest: Nearest-neighbor interpolation
    bilinear: Bilinear interpolation
    bicubic: Bicubic interpolation
scale=float
    Scale factor sampled raster values
    Default: 1.0
null_value=float
    Height for sampled raster NULL values
-t
    Trace elevation
--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 vector map
    Or data source for direct OGR access
    Used as: input, vector, name
layer : str, optional
    Layer number or name ('-1' for all layers)
    A single vector map can be connected to multiple database tables. This number determines which table to use. When used with direct OGR access this is the layer name.
    Used as: input, layer
    Default: -1
cats : str, optional
    Category values
    Example: 1,3,7-9,13
    Used as: input, cats, range
where : str, optional
    WHERE conditions of SQL statement without 'where' keyword
    Example: income < 1000 and population >= 10000
    Used as: input, sql_query, sql_query
type : str | list[str], optional
    Input feature type
    Allowed values: point, line, area
    Default: point,line,area
output : str, required
    Name for output vector map
    Used as: output, vector, name
zshift : float, optional
    Shifting value for z coordinates
    Default: 0
height : float, optional
    Fixed height for 3D vector features
height_column : str, optional
    Name of attribute column with feature height
    Used as: input, dbcolumn, name
elevation : str, optional
    Elevation raster map for height extraction
    Used as: input, raster, name
method : str, optional
    Sampling interpolation method
    Allowed values: nearest, bilinear, bicubic
    nearest: Nearest-neighbor interpolation
    bilinear: Bilinear interpolation
    bicubic: Bicubic interpolation
    Default: nearest
scale : float, optional
    Scale factor sampled raster values
    Default: 1.0
null_value : float, optional
    Height for sampled raster NULL values
flags : str, optional
    Allowed values: t
    t
        Trace elevation
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

v.extrude creates faces, kernels or 3D lines based on input 2D vector features. Points are converted to 3D vertical lines, lines to faces and areas to volumes (composition of closed set of faces and kernel).

If elevation parameter is used then 3D vector features follow the elevation model by using individual elevation values for the vertices. Height for vertices is interpolated from elevation raster map using given interpolation method.

NOTES

v.extrude extrudes vector features which means that points are converted to vertical lines. Lines and area boundaries are extruded to a set of faces, each segment defines one face. Area centroids are written as kernels. Area as a composition of boundaries and centroid is stored as a closed set of faces and kernel which define a volume.

For conversion of 2D points or lines to 3D can be used v.to.3d or v.drape. In opposite to v.extrude, these modules do not extrude vector features, they defines z-coordinate for the features from given parameters or by sampling elevation raster map values. It means that no feature type conversion is applied, points remain still points in the output vector map. Same applies for the lines.

v.extrude modifies only features geometry. Feature categories remain untouched and attribute data is copied from input vector map to the output.

By default, all features (including features without category) from input vector map are processed (layer=-1). Feature selection can be applied by layer, cats or where parameter.

EXAMPLES

3D houses with fixed height

v.extrude input=houses output=houses3D height=5 type=area

3D houses with individual height

v.extrude input=houses output=houses3D elevation=dem height_column=height type=area

Convert 2D points to 3D vertical lines with fixed height

v.extrude input=geodetic_pts output=points3D height=200 type=point

SEE ALSO

v.transform, v.drape, v.to.3d

wxGUI 3D viewer

AUTHORS

Jachym Cepicky,
Updated for GRASS 7 by Martin Landa, FBK-irst, Italy and Czech Technical University in Prague, Czech Republic

SOURCE CODE

Available at: v.extrude source code (history)
Latest change: Friday Feb 07 19:16:09 2025 in commit a82a39f