1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
<h2>DESCRIPTION</h2>
<em>v.external</em> creates new vector map as a link to external OGR
layer or PostGIS feature table. OGR (Simple Features Library) is part
of the
<a href="https://gdal.org">GDAL</a> library, so you need to install
GDAL to use <em>v.external</em> for external OGR layers. Note that a
PostGIS feature table can be linked also using built-in <em>GRASS-PostGIS
data driver</em> (requires GRASS to be built with PostgreSQL support).
<h2>NOTES</h2>
<p>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
<em>v.external</em>. User should learn the difference between those
two formats, because <b>some modules</b> working correctly with GRASS native
data, <b>can produce wrong results</b> with input vector maps created
by <em>v.external</em>.
<p>
<b>Limitations:</b>
<p>
Due to these data model differences <em>v.external</em> 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 <em>v.external</em>. In many cases it
does not make sense to use <em>v.external</em> linked data with simple
features, instead vector data should be imported with <em>v.import</em>
or <em>v.in.ogr</em> to get true topology support. Importantly, point
cloud data which do not have topology, can be linked with <em>v.external</em>
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.
<p>See <em><a href="v.db.connect.html">v.db.connect</a></em> for an
example of maintaining attributes in external DBMS in also writable
mode.
<h3>Supported OGR vector formats</h3>
To list supported OGR formats, type
<div class="code"><pre>
v.external -f
</pre></div>
For details see
<a href="https://gdal.org/en/stable/drivers/vector/">GDAL web site</a>.
<h2>EXAMPLES</h2>
<h3>ESRI Shapefile</h3>
Assuming that 'test_shape.shp' is located in directory
'/home/user/shape_data'.
<div class="code"><pre>
v.external input=/home/user/shape_data layer=test_shape output=grass_map
</pre></div>
<h3>PostGIS layers</h3>
By default, PostGIS links are created by built-in PostGIS support,
ie. using <em>GRASS-PostGIS data driver</em>. If the environment
variable <code>GRASS_VECTOR_OGR</code> exists, or GRASS is compiled
without PostgreSQL support then GRASS will use OGR-PostgreSQL driver
for creating a link.
<p>List of layers for given data source can be printed by <b>-l</b>
flag.
<div class="code"><pre>
v.external input="PG:host=localhost user=postgres dbname=postgis" -l
...
polymap
...
</pre></div>
<div class="code"><pre>
v.external input="PG:host=localhost user=postgres dbname=postgis" layer=polymap
</pre></div>
Note: Authentication details (user password) can be preferably defined
by <em><a href="db.login.html">db.login</a></em>.
<h3>MapInfo files</h3>
Assuming that 'mapinfo_test' MapInfo file is located in the current
directory (".").
<div class="code"><pre>
v.external input=./ layer=mapinfo_test output=grass_map
</pre></div>
<h3>SDTS files</h3>
Note: you have to select the CATD file
<div class="code"><pre>
v.external input=CITXCATD.DDF output=cities
</pre></div>
<h3>TIGER files</h3>
<div class="code"><pre>
v.external input=input/2000/56015/ layer=CompleteChain,PIP output=t56015_all
</pre></div>
<h3>Linking subset of features</h3>
By <b>where</b> option only 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.
<div class="code"><pre>
v.external in="PG:dbname=tiles" layer=wrs2_descending where="pr=191026"
...
Number of areas: 1
...
</pre></div>
<h2>REFERENCES</h2>
<a href="https://gdal.org/en/stable/api/">OGR vector library C
API</a> documentation
<h2>SEE ALSO</h2>
<em>
<a href="v.external.out.html">v.external.out</a>,
<a href="v.clean.html">v.clean</a>,
<a href="v.db.connect.html">v.db.connect</a>,
<a href="v.import.html">v.import</a>,
<a href="v.in.db.html">v.in.db</a>,
<a href="v.in.ogr.html">v.in.ogr</a>,
<a href="v.out.ogr.html">v.out.ogr</a>
</em>
<p>
<a href="https://gdal.org/">GDAL Library</a>
<br>
<a href="https://postgis.net/">PostGIS</a>
<p>
See
also GRASS <a href="https://grasswiki.osgeo.org/wiki/Working_with_external_data_in_GRASS_7">user wiki page</a> for more examples.
<h2>AUTHORS</h2>
Radim Blazek, ITC-Irst, Trento, Italy
<br>
PostGIS support by Martin Landa, GeoForAll (OSGeoREL) Lab, Czech
Technical University in Prague, Czech Republic
|