47
Geoprocessing with GRASS Geoprocessing with GRASS Paolo Zatelli | Università di Trento | 1/47 Geoprocessing with GRASS Paolo Zatelli Dipartimento di Ingegneria Civile e Ambientale Università di Trento

Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 1/47

Geoprocessing with GRASS

Paolo ZatelliDipartimento di Ingegneria Civile e Ambientale

Università di Trento

Page 2: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 2/47

The combination of vector features is used to create new geometric features with:

● overlay of maps with logical operations;

● patch of maps;

● selection of overlapping geometric features;

● evaluation of the distance between features and creation of the minimum length segments;

● creation of points and segments along lines;

● creation of buffers around points, lines and areas.

Combination of vector features

Page 3: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 3/47

The combination of areas with areas, lines and points is done by:

● overlay: creates new maps by combining geometric features using AND, OR, XOR e NOT Boolean operators;

● patch of maps: joins features from different maps, overlapping is allowed;

● select: selects geometric features, without creating new ones;

● dissolving: merges features with the same category (or attribute) into one single feature.

Combination of areas with areas, lines and points

Page 4: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 4/47

Buffering consists in the creation of areas around features (points, lines and areas) with shapes similar to the feature, usually larger:

● with constant width (with respect to two given directions);

● with width dependent on category (width is usually read from a column of the table associated to the map);

● with different widths on the right and left sides, with respect to the lines' o boundaries' direction.

Buffer

Page 5: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 5/47

Other operations combine vector features (point, lines and areas):

● evaluation of distances between points and other features (points, lines and areas), optionally creating vector segments representing the minimum distance;

● creation of points and segments along lines;

● splitting of lines into segments;

● evaluation of geometric features (length, area, etc.) for entities and uploading them to their tables.

Other operations on vector features

Page 6: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 6/47

GRASS' modules for geoprocessing are:● v.extract – extracts vector features from maps according to their

category or to a SQL query on their table;● v.overlay – combines areas with points, lines and areas using

Boolean operator (AND, OR, XOR e NOT);● v.patch – “sums” maps overlaying their features;● v.select – selects (without modifying them) features in a map

overlapping features in another map;● v.buffer – creates buffers around features;● v.parallel – creates lines parallel to lines in a map.

GRASS' modules

Page 7: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 7/47

Other GRASS' modules for geoprocessing:● v.to.db – evaluates, and optionally upload to a table, some

geometric features (length, area, etc.);● v.distance – evaluates distances between point and other features

(points, lines and areas), optionally creating vector segments representing the minimum distance;

● v.to.points – creates points along lines, with given mutual distance;● v.segment – creates points and segments along lines, with a given

distance from the starting point;● v.split – splits lines into segments.

GRASS's modules

Page 8: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 8/47

Some features are common for the GRASS' modules, because they use the same GRASS vector library:● modules do not overwrite existing maps, unless the

--overwrite option is specified;● it is possible to choose the type of feature (point, line,

boundary, centroid, area, face) to process in the input map;● it is possible to choose the layer for categories (thus for the

table).

Common modules' features

Page 9: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 9/47

extracts vector features from maps according to their category or to a SQL query on their table

The syntax is:v.extract [-dtrovq] input=name output=name [type=string[,string,...]] [layer=value] [list=range] [where=sql_query] [file=name] [random=value] [new=value] [--overwrite] [--verbose] [--quiet]

flags: -d Dissolve common boundaries (default is no), -t Do not copy table (see also 'new' parameter) -r Reverse selection, --o Allow output files to overwrite existing files --v Verbose module output, --q Quiet module output

Parameters:input Name of input vector mapoutput Name for output vector maptype Types to be extracted (point,line,boundary,centroid,area,face)layer Layer number (if -1, all features in all layers of given type are extracted) default: 1list Category values (list of the categories to be extracted)where WHERE conditions of SQL statement without 'where' keywordfile Input text file with category numbers/number ranges to be extractedrandom Number of random categories matching vector objects to extractnew -1 to keep original categories or the desired NEW category value.

If new >= 0, table is not copied, default: -1

v.extract

Page 10: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 10/47

Example:

v.extract input=fields@PERMANENT output=fields_mitchell type=area layer=1 new=-1 where="label='C. Mitchell#1' OR label='C. Mitchell#2' OR label='C. Mitchell#3' OR label='C. Mitchell#4' OR label='C. Mitchell#5' OR label='C.

Mitchell#6'"

extracts fields owned by C. Mitchell from the fields map.

v.extract input=soils@PERMANENT output=soils_GBE type=area layer=1 new=-1 where="label='GBE'"

extracts areas with GBE soil type from the soils map.

v.extract

Page 11: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 11/47

v.extract

Page 12: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 12/47

Example with dissolve:

v.extract input=fields@PERMANENT output=fields_mitchell_dissolve type=point,line,boundary,centroid,area,face layer=1 new=1 where="(label='C. Mitchell#1') OR (label='C. Mitchell#2') OR (label='C. Mitchell#3') OR (label='C. Mitchell#4') OR (label='C. Mitchell#5') OR (label='C. Mitchell#6')" -d

extracts fields owned by C. Mitchell from the fields map and create an unique area with category 1.

v.extract

Page 13: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 13/47

dissolveno dissolve

Page 14: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 14/47

combines areas with points, lines and areas using Boolean operator (AND, OR, XOR e NOT).

The syntax is:v.overlay [-t] ainput=name [atype=string[,string,...]] [alayer=integer] binput=name [btype=string[,string,...]] [blayer=integer] output=name [operator=string] [olayer=integer[,integer,...]] [--overwrite] [--verbose] [--quiet]

flags: -t Do not create attribute table, --o allow output files to overwrite existing files --v verbose module output, --q quiet module output

Parameters:ainput Name of input vector map (A)atype Feature type (line, area) (vector map A), default: areaalayer Layer number (vector map A), default: 1binput Name of input vector map (B) btype Feature type (area) (vector map B), default: areablayer Layer number (vector map B), default: 1 output Name for output vector mapoperator Operator (and, or, not, xor), default: orolayer Output layer for new category, ainput and binput, default: 1, 0, 0

v.overlay

Page 15: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 15/47

AND operator (intersection):v.overlay ainput=uno atype=area alayer=1 binput=due btype=area blayer=1 output=test_and operator=and olayer=1,0,0

v.overlay

Page 16: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 16/47

OR operator (union):v.overlay ainput=uno atype=area alayer=1 binput=due btype=area blayer=1 output=test_or operator=or olayer=1,0,0

v.overlay

Page 17: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 17/47

XOR (eXclusive OR) operator:v.overlay ainput=uno atype=area alayer=1 binput=due btype=area blayer=1 output=test_xor operator=xor olayer=1,0,0

v.overlay

Page 18: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 18/47

NOT operator:v.overlay ainput=uno atype=area alayer=1 binput=due btype=area blayer=1 output=test_not operator=not olayer=1,0,0

v.overlay

Page 19: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 19/47

combines features from different maps (two or more) into a new map.

The syntax is:v.patch [-ae] input=string[,string,...] output=string [bbox=name] [--overwrite] [--verbose] [--quiet]

flags: -a Append files to existing file (overwriting existing files must be activated) -e Copy also attribute table Only the table of layer 1 is currently supported --o Allow output files to overwrite existing files --v Verbose module output, --q Quiet module output

Parameters:input Name of input vector map(s)output Name for output vector mapbbox Name for output vector map where bounding boxes of input vector maps are written to

v.patch

Page 20: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 20/47

v.patch input=uno,due output=test_patch -e

v.patch

Page 21: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 21/47

selects (without modifying them) features in a map overlapping features in another map.

The syntax is:v.select [-tr] ainput=name [atype=string[,string,...]] [alayer=value] binput=name [btype=string[,string,...]] [blayer=value] output=name [operator=string] [--overwrite] [--verbose] [--quiet]

flags: -t Do not create attribute table, -r Reverse selection --o Allow output files to overwrite existing files, --v Verbose module output --q Quiet module output

Parameters:ainput Name of input vector map (A)atype Feature type (point,line,boundary,centroid,area) (vector map A) alayer Layer number (vector map A), default: 1binput Name of input vector map (B)btype Feature type (point,line,boundary,centroid,area) (vector map B)blayer Layer number (vector map B), default: 1output Name for output vector mapoperator Operator defines required relation between features (overlap)

v.select

Page 22: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 22/47

v.select ainput=soils atype=area alayer=1 binput=fields_mitchell btype=area blayer=1 output=soils_mitchell_select operator=overlap

v.select - areas

Page 23: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 23/47

v.select ainput=roads atype=line alayer=1 binput=fields_portillo1 btype=area blayer=1 output=roads_portillo_select operator=overlap

v.select - lines

Page 24: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 24/47

creates buffers around features

The syntax is:v.buffer [-sc] input=name output=name [type=string[,string,...]] [layer=value] [distance=value] [minordistance=value] [angle=value] [bufcolumn=name] [scale=value] [tolerance=value] [--overwrite] [--verbose] [--quiet]

flags: -s Make outside corners straight, -c Don't make caps at the ends of polylines --o Allow output files to overwrite existing files, --v Verbose module output --q Quiet module output

Parameters:input Name of input vector mapoutput Name for output vector maptype Feature type (point,line,boundary,centroid,area)layer Layer number, default: 1distance Buffer distance along major axis in map unitsminordistance Buffer distance along minor axis in map unitsangle Angle of major axis in degrees, default: 0bufcolumn Name of column to use for buffer distancesscale Scaling factor for attribute column values, default: 1.0tolerance Maximum distance between theoretical arc and polygon segments

as multiple of buffer, default: 0.01

v.buffer

Page 25: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 25/47

v.buffer input=streams_new output=streams_buffer_line type=line layer=1 distance=200 scale=1.0 tolerance=0.01

v.buffer - lines

Page 26: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 26/47

v.buffer input=streams_new output=streams_buffer_area type=area layer=1 distance=300 scale=1.0 tolerance=0.01

v.buffer - areas

Page 27: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 27/47

v.buffer input=streams_new output=streams_buffer_db_line type=line layer=1 bufcolumn=buffer scale=1.0 tolerance=0.01

v.buffer – widhts from table

Page 28: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 28/47

v.buffer --overwrite --verbose input=line1 output=line_major distance=100

v.buffer – along major axis

Page 29: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 29/47

v.buffer --overwrite --verbose input=line1 output=line_minor distance=1 minordistance=100

v.buffer – along minor axis

Page 30: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 30/47

v.buffer --overwrite --verbose input=line1 output=line_minor distance=1 minordistance=100 angle=45

v.buffer – 45° rotation of axes

Page 31: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 31/47

creates lines parallel to lines in a map.

The syntax is:v.parallel [-rb] input=name output=name distance=value [minordistance=value] [angle=value] side=string [tolerance=value] [--overwrite] [--verbose] [--quiet]

flags: -r Make outside corners round, -b Create buffer-like parallel lines --o Allow output files to overwrite existing files, --v Verbose module output --q Quiet module output

Parameters:input Name of input vector mapoutput Name for output vector mapdistance Offset along major axis in map unitsminordistance Offset along minor axis in map unitsangle Angle of major axis in degrees, default: 0side Side (left, right, both), default: right. left: Parallel line is on the left;

right: Parallel line is on the right; both: Parallel lines on both sidestolerance Tolerance of arc polylines in map units

v.parallel

Page 32: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 32/47

v.parallel input=streams_new output=streams_right side=right distance=100v.parallel input=streams_new output=streams_left side=left distance=300

v.parallel

Page 33: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 33/47

evaluates, and optionally upload to a table, some geometric features (length, area, etc.).

The syntax is:v.to.db [-psc] map=name [type=string[,string,...]] [layer=value] [qlayer=value] option=string [units=string] [column=name[,name,...]] [qcolumn=name] [--verbose] [--quiet]

flags: -p Print only, -s Only print SQL statements -c In print mode prints totals for options: length,area,count --v Verbose module output, --q Quiet module output

Parameters: map Name of input vector map type Feature type (point,line,boundary,centroid) layer Layer number (write to), default: 1 qlayer Query layer number (read from), default: 1

v.to.db

Page 34: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 34/47

continue

option Value to upload (cat, area, compact, fd, perimeter, length, count, coor, start, end, sides, query, slope, sinuous)

cat: insert new row for each category if doesn't exist yet area: area size compact: compactness of an area, calculated as

compactness = perimeter / (2 * sqrt(PI * area)) fd: fractal dimension of boundary defining a polygon, calculated as fd = 2 * (log(perimeter) / log(area))

perimeter: perimeter length of an area length: line length count: number of features for each categorycoor: point coordinates, X,Y or X,Y,Zstart: line/boundary starting point coordinates, X,Y or X,Y,Zend: line/boundary end point coordinates, X,Y or X,Y,Zsides: categories of areas on the left and right side of the boundary, 'qlayer' is used for

area categoryquery: result of a database query for all records of the geometry(or geometries) from

table specified by 'qlayer' optionslope: slope steepness of vector line or boundarysinuous: line sinuousity, calculated as line length / distance between end points

units Units - mi(les),f(eet),me(ters),k(ilometers),a(cres),h(ectares)columns Name of attribute column(s)qcolumn Name of attribute column used for 'query' option

v.to.db

Page 35: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 35/47

gives:

cat|length-1|2426.080714493111|32614.55220763252|183157.299688343|3458.83045471837421|0

the total length for each line category.

v.to.db map=streams_new type=point,line,boundary,centroid layer=1 qlayer=1 option=length units=me column=lenght -p

v.to.db

Page 36: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 36/47

evaluates distances between point and other features (points, lines and areas), optionally creating vector segments representing the minimum distance.

The syntax is:v.distance [-pa] from=name to=name [from_type=string[,string,...]] [to_type=string[,string,...]] [from_layer=value] [to_layer=value] [output=name] [dmax=value] [dmin=value] upload=string[,string,...] column=name[,name,...] [to_column=name] [table=name] [--overwrite] [--verbose] [--quiet]flags:-p Print output to stdout, don't update attribute table.-a Calculate distances to all features within the threshold. The output is written to stdout but may be uploaded to a new table created by this module. --o Allow output files to overwrite existing files. --v Verbose module output --q Quiet module output

Parameters:from Name of existing vector map (from)to Name of existing vector map (to) from_type Feature type (point,centroid) (from), default: point to_type Feature type (point,line,boundary,centroid,area) (to), default: point,line,areafrom_layer Layer number (from), default: 1to_layer Layer number (to), default: 1 output Name for output vector map containing lines connecting nearest elements

v.distance

Page 37: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 37/47

continue

dmax Maximum distance or -1 for no limit, default: -1dmin Minimum distance or -1 for no limit, default: -1upload Values describing the relation between two nearest features options: cat, dist, to_x, to_y, to_along, to_angle, to_attr

cat: category of the nearest featuredist: minimum distance to nearest featureto_x: x coordinate of the nearest point on 'to' featureto_y: y coordinate of the nearest point on 'to' featureto_along: distance between points/centroids in 'from' map and the linear

feature's start point in 'to' map, along this linear featureto_angle: angle between the linear feature in 'to' map and the positive x axis,

at the location of point/centroid in 'from' map, counterclockwise, inradians, which is between -PI and PI inclusive

to_attr: attribute of nearest feature given by to_column optioncolumn Column name(s) where values specified by 'upload' option will be uploadedto_column Column name of nearest feature (used with upload=to_attr)table Name of table created for output when the distance to all (-a) flag is used

v.distance

Page 38: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 38/47

v.distance from=archsites_not_natfor_fields to=bugsites_natfor from_type=point to_type=point,line,area from_layer=1 to_layer=1 output=archsites_not_natfor_dist dmax=-1 upload=dist column=dist -p

v.distance – points and areas

Page 39: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 39/47

v.distance from=archsites@PERMANENT to=roads@PERMANENT output=archistes_to_roads from_type=point to_type=point,line,area from_layer=1 to_layer=1 dmax=-1 upload=dist column=dist

v.distance – points and lines

Page 40: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 40/47

creates points along lines, with given mutual distance.

The syntax is:v.to.points [-nvit] input=name output=name [type=string[,string,...]] [llayer=value] [dmax=value]

flags:-n Write line nodes, -v Write line vertices-i Interpolate points between line vertices, -t Do not create attribute table--o Allow output files to overwrite existing files--v Verbose module output, --q Quiet module output

Parameters:input Input vector map containing linesoutput Output vector map where points will be writtentype Feature type (point,line,boundary,centroid,area)llayer Layer number, default: 1dmax Maximum distance between points in map units, default: 100

v.to.points

The table of the input map is connected on the first layer of the output map, a table containing the category of the underlying line for each point and the progressive distance from the line's starting point is connected on the second layer.

Page 41: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 41/47

v.to.points input=railroads@PERMANENT type=point,line,boundary,centroid output=railroads_points llayer=1 dmax=1000

v.to.points

Page 42: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 42/47

v.to.points input=railroads@PERMANENT type=point,line,boundary,centroid output=railroads_points llayer=1 dmax=1000 -v

v.to.points – with vertexes

Page 43: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 43/47

creates points and segments along lines, with a given distance from the starting point.

The syntax is:v.segment input=name output=name [llayer=value] [file=name] [--overwrite] [--verbose] [--quiet]

--o Allow output files to overwrite existing files --v Verbose module output, --q Quiet module output

Parameters:input Name of input vector map containing linesoutput Name for output vector map where segments will be writtenllayer Line layer, default: 1file Name of file containing segment rules. If not given, read from stdin.

The position of points and segment is given on the stdin:P <point id> <line cat> <offset> [<side offset>]L <segment id> <line cat> <start offset> <end offset> [<side offset>]

echo  "L  2  1  2000  3000"|v.segment  input=railroads  output=railroads_segment_line llayer=1

echo "P 1 1 1000"|v.segment input=railroads output=railroads_segment_point llayer=1

v.segment

Page 44: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 44/47

echo "P 1 1 1000"|v.segment input=railroads output=railroads_segment_point llayer=1

echo "L 2 1 2000 3000"|v.segment input=railroads output=railroads_segment_line llayer=1

v.segment

Page 45: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 45/47

splits lines into segments.

The syntax is:v.split input=name output=name [length=value] [vertices=value]

Flags: --o Allow output files to overwrite existing files --v Verbose module output --q Quiet module output

Parameters:input Name of input vector mapoutput Name for output vector maplength Maximum segment length.vertices Maximum number of vertices in segment.

The vertices parameter sets the maximum number of consecutive vertexes of the input line that each segment can contain (2=only straight segments).

v.split

Page 46: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 46/47

v.split input=railroads output=railroads_split_num vertices=10

v.split

Page 47: Geoprocessing with GRASS · Geoprocessing with GRASSGeoprocessing with GRASS Paolo Zatelli | Università di Trento | 2/47

Geoprocessing with GRASS Geoprocessing with GRASS

Paolo Zatelli | Università di Trento | 47/47

This presentation is © 2009 Paolo Zatelli, available as

License