v.to.rast(1grass)


NAME

   v.to.rast  - Converts (rasterize) a vector map into a raster map.

KEYWORDS

   vector, conversion, raster, rasterization

SYNOPSIS

   v.to.rast
   v.to.rast --help
   v.to.rast  [-d] input=name  [layer=string]   [type=string[,string,...]]
   [cats=range]        [where=sql_query]       output=name      use=string
   [attribute_column=name]      [rgb_column=name]      [label_column=name]
   [value=float]   [memory=integer]   [--overwrite]  [--help]  [--verbose]
   [--quiet]  [--ui]

   Flags:
   -d
       Create densified lines (default: thin lines)
       All  cells  touched  by the line will be set, not only those on the
       render path

   --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,...]
       Input feature type
       Options: point, line, boundary, area
       Default: point,line,area

   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 raster map

   use=string [required]
       Source of raster values
       Options: attr, cat, val, z, dir
       attr: read values from attribute table
       cat: use category values
       val: use value specified by value option
       z: use z coordinate (points or contours only)
       dir: output as flow direction (lines only)

   attribute_column=name
       Name of column for 'attr' parameter (data type must be numeric)

   rgb_column=name
       Name of color definition column (with RRR:GGG:BBB entries)

   label_column=name
       Name of column used as raster category labels

   value=float
       Raster value (for use=val)
       Default: 1

   memory=integer
       Maximum memory to be used (in MB)
       Cache size for raster rows
       Default: 300

DESCRIPTION

   v.to.rast transforms GRASS vector map  layers  into  GRASS  raster  map
   layer  format.  Optionally,  attributes  can  be  converted  to  raster
   category labels.

NOTES

   In order to avoid unexpected  results,  the  type  of  vector  features
   should  always  be  specified.  The  default  is  to convert all vector
   features, but if only e.g. areas  should  be  converted  use  type=area
   rather than type=point,line,area.

   v.to.rast will only affect data in areas lying inside the boundaries of
   the current geographic region.  A grid cell belongs to the  area  where
   the grid cell center falls into.

   Before  running  v.to.rast,  the  user should therefore ensure that the
   current  geographic  region  is  correctly  set  and  that  the  region
   resolution is at the desired level.

   Either  the  column parameter or the value parameter must be specified.
   The use option may be specified alone when using the dir option.

   use options are:

       *   attr - read values from attribute table (default)

       *   cat  - read values from category

       *   val  - use value specified by value option

       *   z    - use z coordinate (points or contours only)

       *   dir  - output as flow direction in degrees (lines only)

   The column parameter uses  an  existing  column  from  the  vector  map
   database table as the category value in the output raster map. Existing
   table columns can be shown by using db.describe.

   An empty raster map layer will be created if the vector map  layer  has
   not  been  assigned  category/attribute  labels  (e.g.,  through use of
   v.category option=add).

   Otherwise:

       *   Labeled areas  and/or  centroids  will  produce  filled  raster
           coverages  with  edges that straddle the original area boundary
           as long as the boundary is NOT labeled.
           (Use v.category option=del type=boundary to remove.)

       *   Labeled lines and boundaries will produce lines of raster cells
           which  touch  the  original  vector line. This tends to be more
           aggressive than area-only conversions.

       *   Points and orphaned centroids will  be  converted  into  single
           cells on the resultant raster map.

   Flow directions are given in degrees counterclockwise from east.

   Raster category labels are supported for all of use= except use=z.

   The -d flag applies only to lines and boundaries, the default is to set
   only those cells on the render path (thin line).

   Boundaries (usually without categories) can be rasterized with
   v.to.rast type=boundary layer=-1 use=val

EXAMPLES

   Convert a vector map and use column SPEED from attribute table
   db.describe -c table=vect_map
   ncols:3
   Column 1: CAT
   Column 2: SPEED
   Column 3: WIDTH
   v.to.rast input=vect_map output=raster_map attribute_column=SPEED type=line

   Calculate stream directions from a river vector map (Spearfish)
   v.to.rast input=streams output=streamsdir use=dir

   Convert a  vector  polygon  map  to  raster  including  descriptive  labels
   (Spearfish)
   v.to.rast input=fields output=myfields use=attr attribute_column=cat label_column=label
   r.category myfields

   Convert vector points to raster with raster cell binning
   In  this  example,  the  number  of schools per raster cell are counted
   (North Carolina sample dataset):
   g.copy vector=schools_wake,myschools_wake
   # set computation region for raster binning
   g.region vector=myschools_wake res=5000 -p -a
   # add new column for counting
   v.db.addcolumn myschools_wake column="value integer"
   v.db.update myschools_wake column=value value=1
   # verify attributes
   v.db.select myschools_wake column=cat,value
   v.out.ascii input=myschools_wake output=- column=value
   # export and import on the fly, use 4th column (value) as input
   v.out.ascii input=myschools_wake output=- column=value | r.in.xyz input=- \
               z=4 output=schools_wake_aggreg method=sum
   d.mon wx0
   d.rast schools_wake_aggreg
   d.vect schools_wake
   d.grid 5000
   Number of schools per raster cell

SEE ALSO

    db.describe, v.category

AUTHORS

   Original code: Michael  Shapiro,  U.S.  Army  Construction  Engineering
   Research Laboratory
   GRASS 6.0 updates: Radim Blazek, ITC-irst, Trento, Italy
   Stream directions: Jaro Hofierka and Helena Mitasova
   GRASS 6.3 code cleanup and label support: Brad Douglas

   Last changed: $Date: 2016-02-22 10:20:45 +0100 (Mon, 22 Feb 2016) $

SOURCE CODE

   Available at: v.to.rast 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.