.TH v.extract 1grass "" "GRASS 6.4.4" "Grass User's Manual" .SH NAME \fI\fBv.extract\fR\fR - Selects vector objects from an existing vector map and creates a new map containing only the selected objects. .SH KEYWORDS vector, extract .SH SYNOPSIS \fBv.extract\fR .br \fBv.extract help\fR .br \fBv.extract\fR [\-\fBdtr\fR] \fBinput\fR=\fIname\fR \fBoutput\fR=\fIname\fR [\fBtype\fR=\fIstring\fR[,\fIstring\fR,...]] [\fBlayer\fR=\fIinteger\fR] [\fBlist\fR=\fIrange\fR] [\fBwhere\fR=\fIsql_query\fR] [\fBfile\fR=\fIname\fR] [\fBrandom\fR=\fIinteger\fR] [\fBnew\fR=\fIinteger\fR] [\-\-\fBoverwrite\fR] [\-\-\fBverbose\fR] [\-\-\fBquiet\fR] .SS Flags: .IP "\fB\-d\fR" 4m .br Dissolve common boundaries (default is no) .IP "\fB\-t\fR" 4m .br Do not copy table (see also 'new' parameter) .IP "\fB\-r\fR" 4m .br Reverse selection .IP "\fB\-\-overwrite\fR" 4m .br Allow output files to overwrite existing files .IP "\fB\-\-verbose\fR" 4m .br Verbose module output .IP "\fB\-\-quiet\fR" 4m .br Quiet module output .PP .SS Parameters: .IP "\fBinput\fR=\fIname\fR" 4m .br Name of input vector map .IP "\fBoutput\fR=\fIname\fR" 4m .br Name for output vector map .IP "\fBtype\fR=\fIstring[,\fIstring\fR,...]\fR" 4m .br Types to be extracted .br Feature type .br Options: \fIpoint,line,boundary,centroid,area,face\fR .br Default: \fIpoint,line,boundary,centroid,area,face\fR .IP "\fBlayer\fR=\fIinteger\fR" 4m .br Layer number (if -1, all features in all layers of given type are extracted) .br A single vector map can be connected to multiple database tables. This number determines which table to use. .br Default: \fI1\fR .IP "\fBlist\fR=\fIrange\fR" 4m .br Category values .br Example: 1,3,7-9,13 .IP "\fBwhere\fR=\fIsql_query\fR" 4m .br WHERE conditions of SQL statement without 'where' keyword .br Example: income = 10000 .IP "\fBfile\fR=\fIname\fR" 4m .br Input text file with category numbers/number ranges to be extracted .br If '-' given reads from standard input .IP "\fBrandom\fR=\fIinteger\fR" 4m .br Number of random categories matching vector objects to extract .br Number must be smaller than unique cat count in layer .IP "\fBnew\fR=\fIinteger\fR" 4m .br Enter -1 to keep original categories or the desired NEW category value .br If new >= 0, table is not copied .br Default: \fI-1\fR .PP .SH DESCRIPTION \fIv.extract\fR allows a user to select vector objects from an existing vector map and creates a new map containing only the selected objects. Database tables can be queried with SQL statements, if a connection is established. Dissolving (optional) is based on the output categories. If 2 adjacent areas have the same output category, the boundary is removed. .PP If \fBlist\fR, \fBfile\fR, \fBrandom\fR or \fBwhere\fR options are not specified, all features of given type and layer are extracted. Categories are not changed in that case. .SH NOTES Only features with a category number will be extracted. So if you want to extract boundaries (which are usually without category, as that information is normally held in the area's centroid) you must first use \fIv.category\fR to add them. .SH EXAMPLES The examples are intended for the North Carolina sample dataset: .SS Extract areas by category number with dissolving #1: \fC .DS .br v.extract \-d list=1,2,3,4 input=soils_wake output=soil_groupa type=area new=0 .br .DE \fR .PP produces a new vector \fBsoil_groupa\fR, containing those areas from vector \fBsoils\fR which have category numbers \fB1 thru 4\fR; any common boundaries are dissolved, and all areas in the new map will be assigned category number 0. .SS Extract areas by category number with dissolving #2: \fC .DS .br v.extract \-d list=1-4 input=soils_wake output=soil_groupa type=area new=-1 .br .DE \fR .PP produces a new vector map \fBsoil_groupa\fR containing the areas from vector \fBsoils\fR which have categories \fB1 thru 4\fR. Any common boundaries are dissolved, all areas in the new map will retain their original category numbers 1 thru 4, since \fBnew\fR was set to -1. .SS Extract all areas and assign the same category to all: \fC .DS .br v.extract input=soils_wake output=soil_groupa type=area new=1 .br .DE \fR .PP produces a new vector map \fBsoil_groupa\fR containing all areas from \fBsoils\fR. No common boundaries are dissolved, all areas of the new map will be assigned category number 1. .SS Extract vectors with SQL: \fC .DS .br v.extract input=markveggy.shp output=markveggy.1 new=13 where="(VEGTYPE = 'Wi') or (VEGTYPE = 'PS') or (PRIME_TYPE='Wi')" .br .DE \fR .PP produces a new vector map with category number 13 if the SQL statement is fulfilled. .SS Extract vector features which have the given field empty: \fC .DS .br v.extract input=lakes output=lakes_gaps where="FTYPE is NULL" .br .DE \fR .SS Extract vector features which have the given field not empty: \fC .DS .br v.extract input=lakes output=lakes_ftype where="FTYPE not NULL" .br .DE \fR .SS Reverse extracting (behaves like selective vector objects deleting): Remove meteorological stations from map which are located above 1000m: \fC .DS .br # check what to delete: .br v.db.select precip_30ynormals where="elev > 1000" .br .br # perform reverse selection .br v.extract \-r precip_30ynormals out=precip_30ynormals_lowland where="elev > 1000" .br .br # verify .br v.db.select precip_30ynormals_lowland .br .DE \fR .SS Dissolving based on column attributes: \fC .DS .br # check column names: .br v.info \-c zipcodes_wake .br .br # reclass based on desired column: .br v.reclass zipcodes_wake out=zipcodes_wake_recl_nam col=ZIPNAME .br .br # verify: .br v.info \-c zipcodes_wake_recl_nam .br v.db.select zipcodes_wake_recl_nam .br .br # dissolve: .br v.extract \-d zipcodes_wake_recl_nam out=zipcodes_wake_regions .br .DE \fR .PP This produces a new vector map with common boundaries dissolved where the reclassed attributes of adjacent (left/right) areas are identical. .SS Remove islands from polygon map \fC .DS .br v.extract in=map_with_islands out=maps_without_islands list=1-99999 .br # and/or .br v.extract \-d in=map_with_islands out=maps_without_islands .br .DE \fR .SS Extract 3 random areas from geology map .PP \fC .DS .br v.extract input=geology output=random_geology type=area random=3 .br .DE \fR This creates a new map with three random categories matching areas. Note that there may be more than one feature with the same category. .SH SEE ALSO \fI v.category, v.dissolve, v.reclass, GRASS SQL interface \fR .SH AUTHORS R.L. Glenn, USDA, SCS, NHQ-CGIS .br GRASS 6 port by Radim Blazek .PP \fILast changed: $Date: 2013-12-27 17:45:42 +0100 (Fri, 27 Dec 2013) $\fR .PP Full index .PP © 2003-2014 GRASS Development Team