other versions
- jessie 6.4.4-1
- stretch 7.2.0-2
- testing 7.6.0-1
- unstable 7.6.0-1
- experimental 7.6.1-1~exp1
| v.distance(1grass) | Grass User's Manual | v.distance(1grass) |
NAME¶
v.distance - Finds the nearest element in vector map 'to' for elements in vector map 'from'.KEYWORDS¶
vector, database, attribute tableSYNOPSIS¶
v.distanceFlags:¶
- -p
-
Print output to stdout, don't update attribute tableFirst column is always category of 'from' feature called from_cat
- -a
-
Calculate distances to all features within the thresholdOutput is written to stdout but may be uploaded to a new table created by this module; multiple 'upload' options may be used.
- --overwrite
-
Allow output files to overwrite existing files
- --verbose
-
Verbose module output
- --quiet
-
Quiet module output
Parameters:¶
- from=name
-
Name of existing vector map (from)
- to=name
-
Name of existing vector map (to)
- from_type=string[,string,...]
-
Feature type (from)Feature typeOptions: point,centroidDefault: point
- to_type=string[,string,...]
-
Feature type (to)Feature typeOptions: point,line,boundary,centroid,areaDefault: point,line,area
- from_layer=integer
-
Layer number (from)A single vector map can be connected to multiple database tables. This number determines which table to use.Default: 1
- to_layer=integer
-
Layer number (to)A single vector map can be connected to multiple database tables. This number determines which table to use.Default: 1
- output=name
-
Name for output vector map containing lines connecting nearest elements
- dmax=float
-
Maximum distance or -1 for no limitDefault: -1
- dmin=float
-
Minimum distance or -1 for no limitDefault: -1
- upload=string[,string,...]
-
Values describing the relation between two nearest featuresOptions: cat,dist,to_x,to_y,to_along,to_angle,to_attrcat: category of the nearest featuredist: minimum distance to nearest featureto_x: x coordinate of the nearest point on the 'to' featureto_y: y coordinate of the nearest point on the 'to' featureto_along: distance to the nearest point on the 'to' feature along that linear featureto_angle: angle along the nearest linear feature in the 'to' map, measured CCW from the +x axis, in radians, between -Pi and Pi inclusiveto_attr: attribute of nearest feature given by to_column option
- column=name[,name,...]
-
Column name(s) where values specified by 'upload' option will be uploaded
- to_column=name
-
Column name of nearest feature (used with upload=to_attr)
- table=name
-
Name of table created when the 'distance to all' flag is used
DESCRIPTION¶
v.distance finds the nearest element in vector map ( to) for elements in vector map ( from). Various information about the vectors' relationships (distance, category, etc.) may be uploaded to the attribute table attached to the first vector map, or printed to ’stdout'. A new vector map may be created where lines connecting nearest points on features are written. dmin and/or dmax can be used to limit the search radius.NOTES¶
If a nearest feature does not have a category, the attribute column is updated to null. This is true also for areas, which means for example, that if a point is in an island (area WITHOUT category), v.distance does not search for the nearest area WITH category; the island is identified as the nearest and category updated to null. The upload column(s) must already exist. Create one with v.db.addcol. In lat-long locations v.distance gives distances (dist and to_along) in meters not in degrees calculated as geodesic distances on a sphere.EXAMPLES¶
Find nearest lines¶
Find nearest lines in vector map ln for points from vector map pnt within the given threshold and write related line categories to column linecat in an attribute table attached to vector map pnt:Find nearest area¶
For each point from vector map pnt, find the nearest area from map ar within the given threshold and write the related area categories to column areacat in an attribute table attached to vector map pnt (in the case that a point falls into a polygon area, the distance is zero):Create a new vector map¶
Create a new vector map which contains lines connecting nearest features of maps pnt and map ln. The resulting vector map can be used for example to connect points to a network as needed for network analysis:Query information¶
Query information from selected point(s). v.distance takes points from a vector map as input instead of stdin. A new vector map with query points has to be created before the map can be analysed. Create query map (if not present):Point-in-polygon¶
The option dmax=0 is here important because otherwise for points not falling into any area, the category of the nearest area is recorded.Univariate statistics on results¶
Create a vector map containing connecting lines and investigate mean distance to targets. An alternative solution is to use the v.distance upload=dist option to upload distances into the bugs vector directly, then run v.univar on that. Also note you can upload two columns at a time, e.g. v.distance upload=cat,dist column=nearest_id,dist_to_nr.to_column=cat column=nrst_arch out=vdistance_vectors_raw
Print distance matrix¶
SEE ALSO¶
r.distance, v.db.addcol, v.what.vectAUTHOR¶
Janne Soimasuo 1994, University of Joensuu, Faculty of Forestry, Finland| GRASS 6.4.4 |