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 >= 10000
  • output=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