Note: A new GRASS GIS stable version has been released: GRASS GIS 7.6, available here.
Updated manual page: here
If areas in ainput are overlaid with areas in binput, it is sometimes necessary to snap areas of binput to those of ainput, otherwise areas can go missing or many sliver areas can be created. Snapping is enabled by default and can be disabled by setting the snap option to a negative value. Recommended values are between 0.00000001 and 0.0001. Using larger values for snapping can have undesired side-effects, but may sometimes be necessary to get a clean output (see example below). In general, it is recommended to start with a small snapping threshold, gradually increasing the threshold until the result is reasonably clean. Snapping modifies only boundaries in binput, which are snapped to boundaries in ainput. Boundaries in ainput are not modified.
If the first number of the olayer option is greater than 0, then the resulting output map has a merged attribute table in the given layer number. The original column names have a prefix (a_ and b_) corresponding to ainput and binput map.
If the second number of the olayer option is greater than 0, then the categories of ainput in layer alayer are transferred to the output layer with the second number.
If the third number of the olayer option is greater than 0, then the categories of binput in layer blayer are transferred to the output layer with the third number.
If atype=auto is given than v.overlay determines feature type for ainput from the first found feature.
# Create an empty box for overlaying to ZIP code vector map v.mkgrid map=box grid=1,1 position=coor coordinates=584037,201970 box=50000,50000 # set region to ZIP codes and box vector maps g.region vector=zipcodes_wake,box -p res=100 -a # enlarge region a bit for "white border" around map in monitor g.region n=n+1000 s=s-1000 w=w-1000 e=e+1000 -p d.mon wx0
d.vect map=zipcodes_wake fill_color=0:128:0 d.vect map=box fill_color=85:130:176 v.overlay -t ainput=box binput=zipcodes_wake operator=and output=v_overlay_AND d.vect map=v_overlay_AND
d.vect map=zipcodes_wake fill_color=0:128:0 d.vect map=box fill_color=85:130:176 v.overlay -t ainput=box binput=zipcodes_wake operator=or output=v_overlay_OR d.vect map=v_overlay_OR
d.vect map=zipcodes_wake fill_color=0:128:0 d.vect map=box fill_color=85:130:176 v.overlay -t ainput=box binput=zipcodes_wake operator=xor output=v_overlay_XOR d.vect map=v_overlay_XOR
d.vect map=zipcodes_wake fill_color=0:128:0 d.vect map=box fill_color=85:130:176 v.overlay -t ainput=box binput=zipcodes_wake operator=not output=v_overlay_NOT d.vect map=v_overlay_NOT
# creation of simple dataset v.extract input=zipcodes_wake output=poly1 where="cat = 42" v.extract input=urbanarea output=poly2 where="cat = 55" v.overlay ainput=poly1 binput=poly2 operator=and output=poly_1_2_and v.overlay ainput=poly1 binput=poly2 operator=or output=poly_1_2_or v.overlay ainput=poly1 binput=poly2 operator=not output=poly_1_2_not v.overlay ainput=poly1 binput=poly2 operator=xor output=poly_1_2_xor
v.overlay ainput=lake binput=province output=lakeXprovince operator=or
# input maps d.vect urbanarea d.vect census_wake2000 # union v.overlay ain=census_wake2000 bin=urbanarea out=urban_census2000 operator=or # show result, graphically zooming a subset g.region n=230400 s=223800 w=655800 e=662400 d.erase d.vect urban_census2000 # show merged attribute table v.db.select urban_census2000 where="cat=108" -v cat|108 a_cat|98 a_AREA|231001264 a_PERIMETE|67804.305 a_TRACT_|98 a_TRACT_ID|98 a_RINGS_OK|1 a_RINGS_NO|0 a_ID|98 a_FIPSSTCO|37183 a_TRT2000|054108 a_STFID|37183054108 a_TRACTID|541.08 a_TRACT|541.08 b_cat|55 b_OBJECTID|55 b_UA|73261 b_NAME|Raleigh b_UA_TYPE|UA
As can be seen by the resulting large number of centroids on boundaries, the urban areas do not match exactly the Census 2000 areas. In this case a clean result can be obtained by snapping with a threshold of 0.1 m.
g.region vector=zipcodes_wake # extract Raleigh city: v.extract in=zipcodes_wake out=raleigh where="ZIPNAME = 'RALEIGH'" # clip road network to city polygon: v.overlay ainput=roadsmajor atype=line binput=raleigh out=roadsmajor_raleigh operator=and olayer=0,1,0
Last changed: $Date: 2016-08-26 02:27:29 -0700 (Fri, 26 Aug 2016) $
Available at: v.overlay source code (history)
Note: A new GRASS GIS stable version has been released: GRASS GIS 7.6, available here.
Updated manual page: here
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
© 2003-2019 GRASS Development Team, GRASS GIS 7.2.4svn Reference Manual