v.out.ogr(1)
v.out.ogr(1) β GRASS GIS User's Manual π
okay bestie, grab a strawberry π because this is the page that yeets your GRASS vector map layer into literally ANY supported OGR vector format. and by default? it goes straight into OGC GeoPackage. no notes. π
β¨ NAME β¨
v.out.ogr β exports a vector map layer to any of the supported OGR vector formats.
By default a vector map layer is exported to OGC GeoPackage format. cute and efficient, we love to see it. π«Ά
π·οΈ KEYWORDS π·οΈ
vector, export, output, OGR
π SYNOPSIS π
v.out.ogr
v.out.ogr --help
v.out.ogr [-uasce2mnl] input=name [layer=string]
[type=string[,string,...]] output=name format=string
[output_layer=string] [output_type=string[,string,...]]
[dsco=string[,string,...]] [lco=string[,string,...]] [--overwrite]
[--help] [--verbose] [--quiet] [--ui]
π© Flags π©
-uβ opens an existing OGR datasource for update. like walking back into the group chat, not starting a new one.-aβ append to existing layer. and if that layer doesn't exist? a new OGR layer gets created, periodt.-sβ skip exporting the GRASS category ID (βcatβ) attribute. bye kitty π-cβ also export features without category (not labeled). otherwise only features with category get exported. it's giving "everybody deserves to be seen".-eβ use ESRI-style.prjfile format (only applies to Shapefile output, iykyk).-2β force 2D output even if the input is 3D (Shapefile output only). genuinely useful if your input is 3D but every single z coordinate is identical β like, why are we pretending π-mβ export vector data as multi-features.-nβ create a new empty layer in the defined OGR datasource and dip. nothing is read from input. main character energy, zero effort.-lβ list supported output formats and exit. the menu, bestie.--overwriteβ allow output files to overwrite existing files π₯--helpβ print usage summary.--verboseβ verbose module output.--quietβ quiet module output π€«--uiβ force launching GUI dialog.
π Parameters π
input=name[required] β name of input vector map to export. or, plot twist, the data source for direct OGR access.layer=stringβ layer number or name. vector features can have category values in different layers, and this number decides which layer we're using. when it's used with direct OGR access, this is the layer name. Default:1type=string[,string,...]β feature type(s). not every output format supports mixing types together, so heads up. default is to use the first type found in the input vector map. Options:point,line,boundary,centroid,area,face,kernel,auto. Default:autooutput=name[required] β name of output OGR datasource. for example: ESRI Shapefile: filename or directory for storage; PostGIS database: connection string.format=string[required] β data format to write. Options:AmigoCloud,Arrow,BAG,CSV,Carto,DGN,DXF,ESRI_Shapefile,Elasticsearch,FITS,FlatGeobuf,GML,GMLAS,GPKG,GPSBabel,GPX,GeoJSON,GeoJSONSeq,GeoRSS,JML,JP2OpenJPEG,JSONFG,KML,LIBKML,MBTiles,MEM,MSSQLSpatial,MVT,MapInfo_File,MapML,MiraMonVector,MySQL,NGW,ODS,OGR_GMT,OpenFileGDB,PCIDSK,PDF,PDS4,PGDUMP,PMTiles,Parquet,PostgreSQL,S57,SQLite,Selafin,VDV,VICAR,WAsP,XLSX,netCDF. Default:GPKGoutput_layer=stringβ name for output OGR layer. if you don't specify one, the input name is used. for example: ESRI Shapefile: shapefile name; PostGIS database: table name.output_type=string[,string,...]β optionally change the default output type. Options:line,boundary. Default:line: export area boundaries as linestrings;boundary: export lines as polygons.dsco=string[,string,...]β OGR dataset creation option (format specific,NAME=VALUE). Default: (empty)lco=string[,string,...]β OGR layer creation option (format specific,NAME=VALUE). Default: (empty)
π DESCRIPTION π
v.out.ogr converts a GRASS vector map layer to any of the supported OGR vector formats β and yes, that includes OGC GeoPackage, ESRI Shapefile, SpatiaLite and GML. we are flexible like that. π¦
OGR (the Simple Features Library) is part of the GDAL library, so bestie, you need to install that library to use v.out.ogr. no GDAL, no party.
the OGR library supports so many various formats, including:
- OGC GeoPackage
- ESRI Shapefile
- PostGIS
- SpatiaLite
- CSV
- GML
- KML
- Mapinfo File
- TIGER
- ... and many others
the list of supported formats is printed with the -l flag. β¨
for further available other supported formats go here.
π NOTES π
by default, islands will appear as holes inside surrounding areas. if you want to export polygons with holes into, e.g., an Esri Shapefile, and make those holes appear as filled areas, you have to use the -c flag. (this is the plot twist of the whole page, ngl.)
v.out.ogr exports 3D vector data as 2.5D simple features if possible (not supported by all formats, sadly π). for exporting 3D vector data as 2D simple features, use the -2 flag.
by default, v.out.ogr converts GRASS vector data to single simple features. if a GRASS feature has more categories defined in the given layer, then that feature gets exported multiple times. GRASS features without category are skipped by default. to export features also without category, you must give the -c flag.
when the -m flag is given, v.out.ogr exports GRASS vector data as multi-features. a multi-feature is formed by GRASS features with the same category. when the -c flag is given, the module also exports GRASS features without category as one multi-feature. note that multi-features are not supported by all formats β vibe check your format first.
ESRI Shapefile export: note that due to the DBF table specifications, column names may not be longer than 10 characters. ten. that's the whole budget. π
Performance: export to SQLite based formats including OGC GeoPackage may become faster with the environmental variable OGR_SQLITE_CACHE=1024 being set (the value depends on available RAM, see OGR ConfigOptions). go off, cache.
πΈ EXAMPLES πΈ
π Export to OGC GeoPackage
export lines from a GRASS vector map to OGC GeoPackage format:
v.out.ogr input=roadsmajor type=line output=roadsmajor.gpkg
export areas from a GRASS vector map to OGC GeoPackage format, converting islands (holes) to filled polygons:
v.out.ogr -c input=areas_islands type=area output=areas_islands.gpkg
export a mixed geometry type GRASS vector map to OGC GeoPackage format:
v.out.ogr input=generic_vector output=mixed_geometry.gpkg
π¦ Export to ESRI Shapefile
export lines from a GRASS vector map to Shapefile format:
v.out.ogr input=roadsmajor type=line format=ESRI_Shapefile output=lines.shp
export areas from a GRASS vector map to Shapefile format, converting islands (holes) to filled polygons:
v.out.ogr -c input=areas_islands type=area format=ESRI_Shapefile output=areas_islands.shp
export 3D lines from a GRASS vector map to Shapefile format:
v.out.ogr input=lines_3d type=line format=ESRI_Shapefile output=lines_3d.shp lco="SHPT=ARCZ"
export 3D points (e.g., Lidar points) from a GRASS vector map to Shapefile format
v.out.ogr points_3d type=point format=ESRI_Shapefile output=points_3d.shp lco="SHPT=POINTZ"
export 3D faces from a GRASS vector map to Shapefile format:
v.out.ogr input=objects_3d type=face format=ESRI_Shapefile output=faces_3d.shp lco="SHPT=POLYGONZ"
export 3D faces from a GRASS vector map to Shapefile format, automatic 3D setting:
v.out.ogr input=objects_3d type=face format=ESRI_Shapefile output=faces_3d.shp"
π Export to GML
export lines from a GRASS vector map to GML format (this generates the '/tmp/testogr.gml' file with the layer 'testogr'):
v.out.ogr input=multi type=line output=/tmp/testogr.gml output_layer=testogr format=GML
π Export to PostgreSQL/PostGIS
export areas from a GRASS vector map to a PostGIS database:
v.out.ogr input=polygons type=area output="PG:host=localhost dbname=postgis user=postgres" output_layer=polymap format=PostgreSQL
Note: for exporting GRASS vector data to a PostGIS database, the v.out.postgis module can also be used. that module is not based on the OGR library, and it supports, beside simple features, also the topological format (PostGIS Topology). iconic of it.
β Export to KML (Google Earth)
export faces (3D vectors) from a GRASS vector map to KML format for Google Earth:
v.out.ogr input=buildings_3d output=buildings_3d.kml output_layer=buildings_3d format=KML type=face
generate and export a GRASS vector "asteroid" map (faces, 3D vectors) to KML format for Google Earth:
# near Raleigh (NC, USA)
g.region n=35.73952587 s=35.73279182 w=-78.68263928 e=-78.67499517
# two layers of random points
v.random -z output=random3d_a n=10 zmin=0 zmax=200
v.random -z output=random3d_b n=15 zmin=400 zmax=600
# merge into one 3D points map
v.patch input=random3d_a,random3d_b output=random3d
# generate 3D convex hull
v.hull input=random3d output="random3d_hull"
# export to KML 3D
v.out.ogr input=random3d_hull output=random3d_hull.kml format=KML type=face dsco="AltitudeMode=absolute"
# now open KML file 'random3d_hull.kml' in Google Earth or NASA WorldWind or ...
π REFERENCES π
- OGR vector library
- OGR vector library C API documentation
π SEE ALSO π
v.out.postgis, db.out.ogr, v.external, v.external.out, v.in.ogr, v.pack
π AUTHORS π
Radim Blazek, ITC-Irst, Trento, Italy
Some contributions: Markus Neteler
Multi-feature support by Martin Landa, Czech Technical University in Prague, 2013
πΎ SOURCE CODE πΎ
Available at: v.out.ogr source code (history)
Accessed: Saturday Jan 17 05:41:35 2026
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
and that's the whole page, bestie π«Ά this was GRASS GIS 8.4.2 Reference Manual energy, Β© 2003-2025 GRASS Development Team, stamped GRASS 8.4.2, accessed Saturday Jan 17 05:41:35 2026 β go export something gorgeous. β¨π
π
π¦ 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