v.external(1grass)

πŸ’– v.external πŸ’–

okay bestie, welcome to the v.external manual page from the GRASS User's Manual, and ngl this one is a whole personality. It Creates a new pseudo-vector map as a link to an OGR-supported layer or a PostGIS feature table. Periodt. ✨

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 πŸŽ€

  • -o β€” Override projection check (use current project's CRS). Basically: assume the dataset is riding with the same coordinate reference system as your current project. No vibe check, just trust. πŸ™ˆ
  • -j β€” Perform projection check only and exit. Like, we're just here to check the fit and then we're leaving.
  • -f β€” List supported formats and exit. Show me the menu, I'm not ordering yet.
  • -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. So extra, so useful. πŸ’…
  • -b β€” Do not build topology. Advantageous when handling a large number of points. (big point-cloud energy, we love a short cut)
  • --overwrite β€” Allow output files to overwrite existing files. Dangerous-ish, use with intention bestie.
  • --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 >= 10000
  • output=name β€” Name for output GRASS vector map (default: input layer).

🌸 DESCRIPTION 🌸

So v.external creates a new vector map as a link to an external OGR layer or a PostGIS feature table. OGR (the Simple Features Library) is part of the GDAL library, meaning you literally need to install GDAL to use v.external for external OGR layers. Also important: a PostGIS feature table can be linked using the built-in GRASS-PostGIS data driver too (this requires GRASS to be built with PostgreSQL support). Two paths, same destination, iconic. 🫢


πŸ’… NOTES πŸ’…

The simple feature data model that OGR (or PostGIS) uses? Very different from the topological format GRASS uses. That's just the truth, no cap. Instead of true topology, what gets created for data linked by v.external is so-called 'pseudo topology'. You should really learn the difference between these two formats, because some modules that work perfectly fine with GRASS native data can produce wrong results with input vector maps created by v.external. 😭

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. Because of that, 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.

go check out v.db.connect for an example of maintaining attributes in an external DBMS in also-writable mode. πŸ’œ

Supported OGR vector formats

To list supported OGR formats, type:

v.external -f

For details see the 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 the GRASS-PostGIS data driver. If the environment variable GRASS_VECTOR_OGR exists, or GRASS is compiled without PostgreSQL support, then GRASS will use the OGR-PostgreSQL driver for creating a link.

List of layers for given data source can be printed by the -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)

Latest change: Monday Dec 08 21:47:55 2025 in commit: d3c6479bef77a58e3b5d85259303dbfb9c1babe8

Main index | Vector index | Topics index | Keywords index | Graphical index | Full index

Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual


okay that's the whole page bestie, you ate it, and this was v.external(1grass) from the GRASS 8.5.0 manual β€” mwah, go link something pretty πŸ’–βœ¨

πŸ“¦ where this page comes from