man v.to.db () - Load values from vector to database. In uploaded/printed category values '-1' is used for 'no category' and 'null'/'-' if category cannot be found or multiple categories were found.
NAME
v.to.db - Load values from vector to database. In uploaded/printed category values '-1' is used for 'no category' and 'null'/'-' if category cannot be found or multiple categories were found.
SYNOPSIS
v.to.db
v.to.db help
v.to.db [-ps] map=string [type=string[,string,...]] [layer=integer] [qlayer=integer] option=string [units=string] [column=string[,string,...]] [qcolumn=string]
Flags:
- "-p
- print only
- "-s
- only print sql statements
Parameters:
- "map=string
- Name of input vector
- "type=string[,string,...]
- Type of elements (for coor valid point/centroid, for length valid line/boundary) Options: point,line,boundary,centroid Default: point,line,boundary,centroid
- "layer=integer
- Layer number Default: 1
- "qlayer=integer
- Query layer. Used by 'query' option. Default: 1
- "option=string
- Value to upload Options: cat,area,length,count,coor,sides,query cat: insert new row for each category if doesn't exist yet area: area size length: line length count: number of features for each category coor: point coordinates, X,Y or X,Y,Z sides: categories of areas on the left and right side of the boundary, 'qlayer' is used for area category query: result of a database query for all records of the geometry(or geometries) from table specified by 'qlayer' option
- "units=string
- mi(les),f(eet),me(ters),k(ilometers),a(cres),h(ectares) Options: mi,miles,f,feet,me,meters,k,kilometers,a,acres,h,hectares
- "column=string[,string,...]
- column(s)
- "qcolumn=string
- Query column used for 'query' option. E.g. 'cat', 'count(*)', 'sum(val)'
DESCRIPTION
v.to.db load values from vector map to database.
NOTES
The units 'miles', 'feet', 'meters' and 'kilometers' are square for option=area.
When using option=coor on a vector area map, only coordinates of centroids with unique category will be reported.
The units 'miles', 'feet', 'meters' and 'kilometers' are square for option=area.
When using option=coor on a vector area map, only coordinates of centroids with unique category will be reported.
EXAMPLES
Updating attribute tables
Note: Uploading of the attributes of a vector map to the DBMS has to be done column-wise. The column must be present in the table (use db.execute to add a new column if needed).
Upload category numbers to attribute table (used for new map):
v.to.db map=soils type=area option=cat
Upload area sizes of each polygon to attribute table:
v.to.db map=soils type=area option=area col=area_size unit=h
Upload line lengths (in meters) of each vector line to attribute table
(use v.category in case of missing categories):
v.to.db map=roads option=length type=line col=linelength units=me
Upload x and y coordinates from vector geometry to attribute table:
v.to.db map=pointsmap option=coor col=x,y
Upload x, y and z coordinates from vector geometry to attribute table:
v.to.db map=pointsmap option=coor col=x,y,z
Printing reports
Report all area sizes of a map:
v.to.db -p soils option=area type=boundary units=h
Report all area sizes of a map, sorted by category number:
v.to.db -p soils option=area type=boundary units=h | sort -n
Report all line lengths of a map:
v.to.db -p roads option=length type=line units=k
Report number of features for each category in map:
v.to.db -p roads option=count type=line
Updating attribute tables
Note: Uploading of the attributes of a vector map to the DBMS has to be done column-wise. The column must be present in the table (use db.execute to add a new column if needed).
Upload category numbers to attribute table (used for new map):
v.to.db map=soils type=area option=cat
Upload area sizes of each polygon to attribute table:
v.to.db map=soils type=area option=area col=area_size unit=h
Upload line lengths (in meters) of each vector line to attribute table
(use v.category in case of missing categories):
v.to.db map=roads option=length type=line col=linelength units=me
Upload x and y coordinates from vector geometry to attribute table:
v.to.db map=pointsmap option=coor col=x,y
Upload x, y and z coordinates from vector geometry to attribute table:
v.to.db map=pointsmap option=coor col=x,y,z
Printing reports
Report all area sizes of a map:
v.to.db -p soils option=area type=boundary units=h
Report all area sizes of a map, sorted by category number:
v.to.db -p soils option=area type=boundary units=h | sort -n
Report all line lengths of a map:
v.to.db -p roads option=length type=line units=k
Report number of features for each category in map:
v.to.db -p roads option=count type=line
NOTES
The units 'miles', 'feet', 'meters' and 'kilometers' are square for option=area.
When using option=coor on a vector area map, only coordinates of centroids with unique category will be reported.
EXAMPLES
Updating attribute tables
Note: Uploading of the attributes of a vector map to the DBMS has to be done column-wise. The column must be present in the table (use db.execute to add a new column if needed).
Upload category numbers to attribute table (used for new map):
v.to.db map=soils type=area option=cat
Upload area sizes of each polygon to attribute table:
v.to.db map=soils type=area option=area col=area_size unit=h
Upload line lengths (in meters) of each vector line to attribute table
(use v.category in case of missing categories):
v.to.db map=roads option=length type=line col=linelength units=me
Upload x and y coordinates from vector geometry to attribute table:
v.to.db map=pointsmap option=coor col=x,y
Upload x, y and z coordinates from vector geometry to attribute table:
v.to.db map=pointsmap option=coor col=x,y,z
Printing reports
Report all area sizes of a map:
v.to.db -p soils option=area type=boundary units=h
Report all area sizes of a map, sorted by category number:
v.to.db -p soils option=area type=boundary units=h | sort -n
Report all line lengths of a map:
v.to.db -p roads option=length type=line units=k
Report number of features for each category in map:
v.to.db -p roads option=count type=line
NOTES
If the module is apparently slow and the map attributes are stored in an external DBMS such as PostgreSQL, it is highly recommended to create an index on the key (category) column.
SEE ALSO
v.category
AUTHOR
Radim Blazek
Last changed: $Date: 2005/05/10 09:04:44 $
Help Index