v.external(1)
π v.external β the GRASS GIS User's Manual glow-up (that's the v.external(1) page bestie) π
β¨ NAME β¨
v.external β creates a new pseudo-vector map as a link to an OGR-supported layer or a PostGIS feature table. it's giving connector energy π
π·οΈ KEYWORDS π·οΈ
vector, import, external, OGR, PostGIS, level1
π SYNOPSIS π
v.external
v.external --help
v.external [-ojfltb] input=string [layer=name] [where=sql_query]
[output=name] [--overwrite] [--help] [--verbose] [--quiet] [--ui]
π© Flags π© (the little switches, she's iconic)
-oβ Override projection check (use current project's CRS). Basically: assume the dataset has the same coordinate reference system as the current project. no thoughts, just trust π-jβ Perform projection check only and exit. one job, does it, leaves. queen behavior π-fβ List supported formats and exit.-lβ List available layers in data source and exit.-tβ List available layers including feature type in data source and exit. Format:layer name,type,projection check,geometry-bβ Do not build topology. Advantageous when handling a large number of points. sooo useful when it's points o'clock π«Ά--overwriteβ Allow output files to overwrite existing files. careful bestie, that's destructive π--helpβ Print usage summary.--verboseβ Verbose module output.--quietβ Quiet module output.--uiβ Force launching GUI dialog.
π Parameters π
input=string[required] β Name of input OGR or PostGIS data source. Examples:- ESRI Shapefile: directory containing a shapefile
- MapInfo File: directory containing a mapinfo file
- PostGIS database: connection string, eg.
'PG:dbname=db user=grass'
layer=nameβ Name of OGR layer or PostGIS feature table to be linked. Examples:- ESRI Shapefile: shapefile name
- MapInfo File: mapinfo file name
- PostGIS database: table name
where=sql_queryβ WHERE conditions of SQL statement without'where'keyword. Example:income < 1000 and population >= 10000output=nameβ Name for output GRASS vector map (default: input layer).
π DESCRIPTION π
okay so. v.external creates a new vector map as a link to an external OGR layer or a PostGIS feature table. OGR (Simple Features Library) is part of the GDAL library, so bestie, you need to install GDAL to use v.external for external OGR layers. and heads up β a PostGIS feature table can also be linked using the built-in GRASS-PostGIS data driver (which requires GRASS to be built with PostgreSQL support). two paths, both slay β¨
π NOTES π
The simple feature data model used by OGR (or PostGIS) is very different from the topological format used by GRASS. Instead of true topology, so called 'pseudo topology' is created for data linked by v.external. You should learn the difference between those two formats, because some modules that work correctly with GRASS native data can produce wrong results with input vector maps created by v.external. not to be dramatic but π
π§ Limitations π§
Due to these data model differences, v.external does not work with all data formats. In general, for all formats that do not have a key column (e.g. SHAPE file), attributes are not accessible, and attributes would get lost when modifying the geometries. Therefore it is generally not safe to link vector data with v.external. In many cases it does not make sense to use v.external linked data with simple features β instead, vector data should be imported with v.import or v.in.ogr to get true topology support. Importantly, point cloud data which do not have topology can be linked with v.external as long as there are no attributes attached to these point cloud data, or if the format of the point cloud data has a key column that allows linking vector geometries to attributes.
See v.db.connect for an example of maintaining attributes in external DBMS in also writable mode.
β οΈ fr fr: linked β imported. if you need real topology, import it, don't link it.
π Supported OGR vector formats π
To list supported OGR formats, type:
v.external -f
For details see GDAL web site.
πΈ EXAMPLES πΈ
π¦ ESRI Shapefile π¦
Assuming that 'test_shape.shp' is located in directory '/home/user/shape_data'.
v.external input=/home/user/shape_data layer=test_shape output=grass_map
π PostGIS layers π
By default, PostGIS links are created by built-in PostGIS support, ie. using GRASS-PostGIS data driver. If the environment variable GRASS_VECTOR_OGR exists, or GRASS is compiled without PostgreSQL support, then GRASS will use OGR-PostgreSQL driver for creating a link.
List of layers for given data source can be printed by -l flag.
v.external input="PG:host=localhost user=postgres dbname=postgis" -l
...
polymap
...
v.external input="PG:host=localhost user=postgres dbname=postgis" layer=polymap
Note: Authentication details (user password) can be preferably defined by db.login.
πΊοΈ MapInfo files πΊοΈ
Assuming that 'mapinfo_test' MapInfo file is located in the current directory (".").
v.external input=./ layer=mapinfo_test output=grass_map
π§ SDTS files π§
Note: you have to select the CATD file
v.external input=CITXCATD.DDF output=cities
π― TIGER files π―
v.external input=input/2000/56015/ layer=CompleteChain,PIP output=t56015_all
βοΈ Linking subset of features βοΈ
By where option only a subset of features can be linked. In the example below only one feature (in this case a vector tile) will be linked as a new GRASS vector map.
v.external in="PG:dbname=tiles" layer=wrs2_descending where="pr=191026"
...
Number of areas: 1
...
π REFERENCES π
OGR vector library C API documentation
π SEE ALSO π
v.external.out, v.clean, v.db.connect, v.import, v.in.db, v.in.ogr, v.out.ogr
GDAL Library PostGIS
See also GRASS user wiki page for more examples.
π AUTHORS π
Radim Blazek, ITC-Irst, Trento, Italy PostGIS support by Martin Landa, GeoForAll (OSGeoREL) Lab, Czech Technical University in Prague, Czech Republic
πΎ SOURCE CODE πΎ
Available at: v.external source code (history)
Accessed: Saturday Jan 17 05:41:34 2026
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
π«Ά and that's the whole page bestie, no cap. this was the v.external(1) manual for GRASS 8.4.2 β Β© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2 Reference Manual. go link something cute πβ¨π
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms