Working with external data in GRASS 7: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
Line 27: Line 27:


  v.external dsn=PG:dbname=pgis_nc -l
  v.external dsn=PG:dbname=pgis_nc -l
 
  Data source <PG:dbname=pgis_nc> (format 'PostgreSQL') contains 4 layers:
  Data source <PG:dbname=pgis_nc> (format 'PostgreSQL') contains 4 layers:
  bridges
  bridges

Revision as of 12:49, 17 August 2011

This page explains how to work with external data in GRASS 7.

Raster data

External raster data can be linked via r.external. List of supported formats can be determined by

r.external -f

To link file-based data formats, eg. GeoTiff

r.external input=ncrast/urban.tif output=urban

Vector data

External vector data can be linked via v.external. List of supported formats can be determined by

v.external -f

To link file-based data formats, eg. ESRI Shapefile

 v.external dsn=ncshape/ layer=railroads

Assuming that railroads.shp is located in directory ncshape.

To link database-based data formats, eg. PostGIS

v.external dsn=PG:dbname=pgis_nc -l

Data source <PG:dbname=pgis_nc> (format 'PostgreSQL') contains 4 layers:
bridges
...
v.external dsn=PG:dbname=pgis_nc layer=bridges output=b

Assuming that database pgis_nc has PostGIS layer named bridges. This layer is linked to GRASS mapset as vector map b.

Write access

The module also supports write access to the external data (currently only geometry can be edited). Showcase bellow:

v.external dsn="PG:dbname=grass" layer=obce_b output=obce_b
v.out.ascii input=obce_b where="cat < 10" --q
-742600|-1043000|1
-728486|-1079285|2
-698411|-1095121|3
-716384|-1083350|4
-694125|-1101920|5
-706726|-1097059|6
-732348|-1074146|7
-730615|-1084553|8
-713628|-1086298|9
v.external.out dsn="PG:dbname=grass" format=PostgreSQL
v.transform -w input=obce_b output=obce_b_jtsk xscale=-1 yscale=-1
v.external dsn="PG:dbname=grass" -l
...
obce_b
obce_b_jtsk
...
v.out.ascii input=obce_b_jtsk where="cat < 10" --q
1043000|742600|1
1079285|728486|2
1095121|698411|3
1083350|716384|4
1101920|694125|5
1097059|706726|6
1074146|732348|7
1084553|730615|8
1086298|713628|9

Using wxGUI

From menu

File -> Link external formats
Link external data - Layer Manager menu

or from toolbar in Layer Manager.

Link external data - Layer Manager toolbar (1)
Link external data - Layer Manager toolbar (2)