Skip to content

v.db.droprow

Removes a vector feature from a vector map through attribute selection.

v.db.droprow input=name [layer=string] where=sql_query output=name [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

v.db.droprow input=name where=sql_query output=name

grass.script.run_command("v.db.droprow", input, layer="1", where, output, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("v.db.droprow", input="name", where="sql_query", output="name")

Parameters

input=name [required]
    Name of input vector map
    Or data source for direct OGR access
layer=string
    Layer number or name
    Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
    Default: 1
where=sql_query [required]
    WHERE conditions of SQL statement without 'where' keyword
    Example: income < 1000 and population >= 10000
output=name [required]
    Name for output vector map
--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
    Vector features can have category values in different layers. This number determines which layer to use. When used with direct OGR access this is the layer name.
    Used as: input, layer
    Default: 1
where : str, required
    WHERE conditions of SQL statement without 'where' keyword
    Example: income < 1000 and population >= 10000
    Used as: input, sql_query, sql_query
output : str, required
    Name for output vector map
    Used as: output, vector, name
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.db.droprow removes vector object(s) (point, line, area, face etc.) from a vector map through attribute selection in the table connected to the given vector map. It automatically checks the connection for the specified layer.

NOTES

v.db.droprow is a front-end to v.extract (reverse selection) to allow easier usage. The existing database connection(s) can be verified with v.db.connect.

EXAMPLES

Dropping all vector points without elevation attribute (North Carolina data set):

g.region raster=elevation -p
v.random output=rand5k_elev n=5000

v.db.addtable map=rand5k_elev column="elevation double precision"
v.what.rast vect=rand5k_elev rast=elevation column=elevation

# verify absence of some elevation attributes ("number of NULL attributes"):
v.univar rand5k_elev type=point column=elevation

# Remove all vector points lacking elevation attribute
v.db.droprow rand5k_elev output=rand5k_elev_filt where="elevation IS NULL"

# verify:
v.univar rand5k_elev_filt type=point column=elevation

SEE ALSO

db.droptable, db.execute, v.db.addcolumn, v.db.addtable, v.db.connect, v.db.dropcolumn, v.db.droptable, v.db.select, v.db.update

GRASS SQL interface

AUTHOR

Markus Neteler

SOURCE CODE

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