v.extract(1grass)


NAME

   v.extract   -  Selects  vector features from an existing vector map and
   creates a new vector map containing only the selected features.

KEYWORDS

   vector, extract, select, dissolve, random

SYNOPSIS

   v.extract
   v.extract --help
   v.extract          [-dtr]          input=name            [layer=string]
   [type=string[,string,...]]        [cats=range]        [where=sql_query]
   output=name      [file=name]       [random=integer]       [new=integer]
   [--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

   Flags:
   -d
       Dissolve common boundaries (default is no)

   -t
       Do not copy attributes (see also 'new' parameter)

   -r
       Reverse selection

   --overwrite
       Allow output files to overwrite existing files

   --help
       Print usage summary

   --verbose
       Verbose module output

   --quiet
       Quiet module output

   --ui
       Force launching GUI dialog

   Parameters:
   input=name [required]
       Name of input vector map
       Or data source for direct OGR access

   layer=string
       Layer number or name
       Vector  features can have category values in different layers. This
       number determines which layer to use. When  used  with  direct  OGR
       access this is the layer name.
       Default: 1

   type=string[,string,...]
       Types to be extracted
       Input feature type
       Options: point, line, boundary, centroid, area, face
       Default: point,line,boundary,centroid,area,face

   cats=range
       Category values
       Example: 1,3,7-9,13

   where=sql_query
       WHERE conditions of SQL statement without 'where' keyword
       Example: income < 1000 and inhab >= 10000

   output=name [required]
       Name for output vector map

   file=name
       Input text file with category numbers/number ranges to be extracted
       If '-' given reads from standard input

   random=integer
       Number of random categories matching vector objects to extract
       Number must be smaller than unique cat count in layer

   new=integer
       Desired new category value (enter -1 to keep original categories)
       If new >= 0, attributes is not copied
       Default: -1

DESCRIPTION

   v.extract  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.

   If cats, file, random or where options are not specified, all  features
   of  given  type  and layer are extracted. Categories are not changed in
   that case.

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
   v.category to add them.

EXAMPLES

   The examples are intended for the North Carolina sample dataset:

   Extract areas by category number with dissolving #1:
   v.extract -d cats=1,2,3,4 input=soils_wake output=soil_groupa type=area new=0

   produces  a  new vector soil_groupa, containing those areas from vector
   soils which have category numbers 1 thru 4; any common  boundaries  are
   dissolved,  and  all  areas  in  the  new map will be assigned category
   number 0.

   Extract areas by category number with dissolving #2:
   v.extract -d cats=1-4 input=soils_wake output=soil_groupa type=area new=-1

   produces a new vector map soil_groupa containing the areas from  vector
   soils  which  have  categories  1  thru  4.  Any  common boundaries are
   dissolved, all areas in the new map will retain their original category
   numbers 1 thru 4, since new was set to -1.

   Extract all areas and assign the same category to all:
   v.extract input=soils_wake output=soil_groupa type=area new=1

   produces  a new vector map soil_groupa containing all areas from soils.
   No common boundaries are dissolved, all areas of the new  map  will  be
   assigned category number 1.

   Extract vectors with SQL:
   v.extract input=markveggy.shp output=markveggy.1 new=13 \
     where="(VEGTYPE = 'Wi') or (VEGTYPE = 'PS') or (PRIME_TYPE='Wi')"

   produces  a new vector map with category number 13 if the SQL statement
   is fulfilled.

   Extract vector features which have the given field empty:
   v.extract input=lakes output=lakes_gaps where="FTYPE is NULL"

   Extract vector features which have the given field not empty:
   v.extract input=lakes output=lakes_ftype where="FTYPE not NULL"

   Reverse extracting (behaves like selective vector objects deleting):
   Remove meteorological stations from map which are located above 1000m:
   # check what to delete:
   v.db.select precip_30ynormals where="elev > 1000"
   # perform reverse selection
   v.extract -r input=precip_30ynormals output=precip_30ynormals_lowland \
     where="elev > 1000"
   # verify
   v.db.select precip_30ynormals_lowland

   Dissolving based on column attributes:
   # check column names:
   v.info -c zipcodes_wake
   # reclass based on desired column:
   v.reclass input=zipcodes_wake output=zipcodes_wake_recl_nam column=ZIPNAME
   # verify:
   v.info -c zipcodes_wake_recl_nam
   v.db.select zipcodes_wake_recl_nam
   # dissolve:
   v.extract -d input=zipcodes_wake_recl_nam output=zipcodes_wake_regions

   This produces a new vector map with common boundaries  dissolved  where
   the reclassed attributes of adjacent (left/right) areas are identical.

   Extract 3 random areas from geology map
   v.extract input=geology output=random_geology type=area random=3
   This  creates  a  new  map with three random categories matching areas.
   Note that there may be more than one feature with the same category.

SEE ALSO

    v.category, v.dissolve, v.reclass, GRASS SQL interface

AUTHORS

   R.L. Glenn, USDA, SCS, NHQ-CGIS
   GRASS 6 port by Radim Blazek

   Last changed: $Date: 2016-03-16 21:17:59 +0100 (Wed, 16 Mar 2016) $

SOURCE CODE

   Available at: v.extract source code (history)

   Main index | Vector index | Topics index | Keywords index  |  Graphical
   index | Full index

    2003-2016 GRASS Development Team, GRASS GIS 7.2.0 Reference Manual





Opportunity


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.





Free Software


Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.


Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.





Free Books


The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.


Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.





Education


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.


Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.