wiki:Grass7/VectorLib/OGRInterface

Version 48 (modified by martinl, 13 years ago) ( diff )

--

OGR interface in GRASS 7

See also examples from GRASS User Wiki.

Direct OGR read access

Capability to read OGR layers directly without linking them via v.external.

Example 1: Shapefile 'busstopsall.shp' located in directory '~/shapefiles'

v.info map=~/shapefiles/@OGR layer=busstopsall

Example 2: PostGIS table 'busstopsall' located in database 'pgis_nc'.

v.extract input=PG:dbname=pgis_nc@OGR layer=busstopsall where="STREET_1 = 'William Moore Dr.'" output=b1

List of modules which supports direct OGR read access ((*) indicates work in progress):

Direct OGR write access

Capability to write OGR layers directly without need to store data in the native GRASS vector format and then exporting data using v.out.ogr.

Testcase:

Scenario 1 (not implemented)

Use parameters output for output OGR datasource and olayer for OGR layer. Example:

# input: GRASS data
# output: PostGIS database
v.extract input=bridges where="BRIDGE_NUM=417" output=bridges_417

# input: PostGIS layer, ESRI Shapefile
# output: PostGIS database
v.select ainput=PG:dbname=gisdb@OGR alayer=zeleznice \
 binput=shps@OGR blayer=obce operator=intersects \
 output=PG:dbname=gisdb@OGR olayer=obce_zelez

Status: not planned to be implemented

Scenario 2 (implemented)

Design v.external.out (similarly to r.external.out)

# input: GRASS data
# output: PostGIS database
v.external.out dsn=PG:dbname=pgis_nc format=PostgreSQL
v.extract input=bridges where="BRIDGE_NUM=417" output=bridges_417

# input: PostGIS layer, ESRI Shapefile
# output: PostGIS database
v.select ainput=PG:dbname=pgis_nc@OGR alayer=roadsmajor \
 binput=~/shapefiles@OGR blayer=boundary_municp operator=intersects \
 output=municp_roads

Status: implemented grass/trunk/vector/v.external.out

Tasks

  • Attribute table (write) access for OGR-linked vectors (direct or linked by v.external)

Changes in vector library

Current status

List of modules which will not support direct OGR read access:

  • v.build
  • v.build.all

List of modules which supports direct OGR write access:

  • v.edit
  • v.extract
  • v.select
  • v.random

List of modules which needs to updated:

  • v.buffer
  • v.build.polylines
  • v.category
  • v.centroids

Related OGR tickets

Note: See TracWiki for help on using the wiki.