By default GRASS GIS topological features are converted into simple features (see OGC Simple Feature Access specification for details). Flag -l allows to export vector features as topological elements stored in PostGIS Topology schema. Note that topological export requires PostGIS version 2 or later.
Additional creation options can be defined by options parameter:
FID=<column>
- name of column which will be used as
primary key (feature id), default: fid
GEOMETRY_NAME=<column>
name of column which will
be used for storing geometry data in feature table, default: geom
SPATIAL_INDEX=YES|NO
- enable/disable creating spatial
index on geometry column, default: YES
PRIMARY_KEY=YES|NO
- enable/disable adding primary key
on FID column, default: YES
SRID=<value>
- spatial reference identifier,
default: not definedTOPOSCHEMA_NAME=<schema name>
- name of PostGIS
Topology schema, default: topo_<input>
TOPOGEOM_NAME=<column>
- name of column which
will be used for storing topogeometry data in feature table,
default: topo
TOPO_TOLERANCE=<value>
- tolerance for PostGIS
Topology schema,
see CreateTopology
function for details, default: 0
TOPO_GEO_ONLY=YES|NO
- store in PostGIS Topology schema
only data relevant to Topo-Geo data model,
default: NO
Creation options are comma-separated pairs
(key=value
), the options are case-insensitive. Note
that options defined
by v.external.out are
ignored by v.out.postgis.
v.out.postgis optionally also creates a new vector map in the current mapset if output_link is defined.
GEOMETRY_NAME=<column>
. Note that for
exporting vector features as simple features can be alternatively
used PostgreSQL driver
from OGR library
through v.out.ogr module.
Also note that it's allowed to store in the feature table only features of the same type, ie. mixing of points and lines is not currently possible. The feature type is determined for output feature table from the first vector feature accessing data sequentially (type=auto). Vector features of other types are during export skipped. User can choose preferable feature type by type parameter. Only single type is currently allowed (see TODO section for details).
v.out.postgis currently supports only three basic output
simple feature types: Points, Linestrings and Polygons. Also 3D
features of the same type are supported, eg. 3D points are exported
as PointZ
simple feature. Faces are exported as 3D
polygons. 3D features are written to the output automatically if input
vector map is 3D. If -2 flag is given then the output is always
2D (z-coordinate is silently ignored for 3D input vector maps).
Multigeometries are not currently supported. Features with the same category are exported as multiple single features.
v.out.postgis also allows exporting vector features as topological elements in PostGIS Topology schema. PostGIS Topology extension uses three tables to store basic topological elements which forms topological objects like areas or isles in GRASS terminology. Nodes (0-dimensional topological elements) are stored in "node" table, edges (1-dimensional elements) in "edge" table and faces (2-dimensional elements) in "face" table.
topo_<input>
. Alternatively, the name for topology
schema can be defined
by options=TOPOSCHEMA_NAME=<name>
.
v.out.postgis input=urbanarea output="PG:dbname=grass"
db.select driver=pg database=grass \ sql="SELECT ST_GeometryType(geom) as geom_type, count(*) from urbanarea group by geom_type" geom_type|count ST_Polygon|657
v.out.ogr input=urbanarea output="PG:dbname=grass" format=PostgreSQL
<schema_name>.<table_name>
. If the specified
schema doesn't exist in the database, then it's automatically created.
Export vector map "bridges" as feature table in database schema "grassout".
v.out.postgis input=bridges output="PG:dbname=grass" output_layer=grassout.bridges
srid
identifier which corresponds in this case with EPSG
3358 (North Carolina dataset).
v.out.postgis input=roadsmajor output="PG:dbname=grass" options="GEOMETRY_NAME=wkb_geometry,SPATIAL_INDEX=NO,SRID=3358"
v.out.postgis input=busstopsall@PERMANENT output="PG:dbname=grass" output_link=busstopsall_pg
v.info busstopsall_pg ... |----------------------------------------------------------------------------| | Map format: PostGIS (PostgreSQL) | | DB table: public.busstopsall | | DB name: grass | | Geometry column: geom | | Feature type: point | | Topology: pseudo (simple features) | |----------------------------------------------------------------------------| ...
v.out.postgis -t input=railroads output="PG:dbname=grass"
v.out.postgis -l input=busroutesall output="PG:dbname=grass"
See also PostGIS and PostGIS Topology wiki page from GRASS User Wiki.
Available at: v.out.postgis source code (history)
Latest change: Tuesday Dec 17 20:17:20 2024 in commit: ab90c5e5a9b668894da360fa97ffd4a51a38931e
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
© 2003-2024 GRASS Development Team, GRASS GIS 8.5.0dev Reference Manual