[GRASS-SVN] r69167 - in grass/trunk/vector: v.mkgrid v.vect.stats

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Aug 20 15:08:40 PDT 2016


Author: wenzeslaus
Date: 2016-08-20 15:08:40 -0700 (Sat, 20 Aug 2016)
New Revision: 69167

Added:
   grass/trunk/vector/v.mkgrid/v_mkgrid.png
   grass/trunk/vector/v.vect.stats/v_vect_stats.png
Modified:
   grass/trunk/vector/v.mkgrid/main.c
   grass/trunk/vector/v.mkgrid/v.mkgrid.html
   grass/trunk/vector/v.vect.stats/v.vect.stats.html
Log:
v.mkgrid and v.vect.stats: add examples with hexagons

Modified: grass/trunk/vector/v.mkgrid/main.c
===================================================================
--- grass/trunk/vector/v.mkgrid/main.c	2016-08-20 19:32:03 UTC (rev 69166)
+++ grass/trunk/vector/v.mkgrid/main.c	2016-08-20 22:08:40 UTC (rev 69167)
@@ -71,6 +71,7 @@
     G_add_keyword(_("geometry"));
     G_add_keyword(_("grid"));
     G_add_keyword(_("point pattern"));
+    G_add_keyword(_("hexagon"));
     module->description = _("Creates a vector map of a user-defined grid.");
 
     vectname = G_define_standard_option(G_OPT_V_OUTPUT);

Modified: grass/trunk/vector/v.mkgrid/v.mkgrid.html
===================================================================
--- grass/trunk/vector/v.mkgrid/v.mkgrid.html	2016-08-20 19:32:03 UTC (rev 69166)
+++ grass/trunk/vector/v.mkgrid/v.mkgrid.html	2016-08-20 22:08:40 UTC (rev 69167)
@@ -129,6 +129,52 @@
 Hexagon map
 </center>
 
+<h3>Using hexagons for point density</h3>
+
+To compute point density in a hexagonal grid for the vector map
+<em>points_of_interest</em> in the basic North Carolina sample dataset,
+the vector map itself is used to set extent of the computational region.
+The resolution is based on the desired size of hexagons.
+
+<div class="code"><pre>
+g.region vector=points_of_interest res=2000 -pa
+</pre></div>
+
+The hexagonal grid is created as a vector map based on the previously
+selected extent and size of the grid.
+
+<div class="code"><pre>
+v.mkgrid map=hexagons -h
+</pre></div>
+
+The following counts the number of points per hexagon using the
+<em><a href="v.vect.stats.html">v.vect.stats</a></em> module.
+
+<div class="code"><pre>
+v.vect.stats points=points_of_interest areas=hexagons count_column=count
+</pre></div>
+
+User should note that some of the points may be outside the grid
+since the hexagons cannot cover all the area around the edges
+(the computational region extent needs to be enlarged if all points
+should be considered).
+The last command sets the vector map color table to <tt>viridis</tt>
+based on the <tt>count</tt> column.
+
+<div class="code"><pre>
+v.colors map=hexagons use=attr column=count color=viridis
+</pre></div>
+
+<!--
+d.erase 77:77:77
+mogrify -trim .png
+-->
+
+<center>
+<img src="v_mkgrid.png"><br>
+Point density in a hexagonal grid
+</center>
+
 <h2>SEE ALSO</h2>
 
 <em>

Added: grass/trunk/vector/v.mkgrid/v_mkgrid.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/vector/v.mkgrid/v_mkgrid.png
___________________________________________________________________
Added: svn:mime-type
   + image/png

Modified: grass/trunk/vector/v.vect.stats/v.vect.stats.html
===================================================================
--- grass/trunk/vector/v.vect.stats/v.vect.stats.html	2016-08-20 19:32:03 UTC (rev 69166)
+++ grass/trunk/vector/v.vect.stats/v.vect.stats.html	2016-08-20 22:08:40 UTC (rev 69167)
@@ -145,7 +145,90 @@
 v.db.select myzipcodes_wake column=ZIPCODE_,ZIPNAME,avg_elev
 </pre></div>
 
+<h3>Point statistics in a hexagonal grid</h3>
 
+The grid extent and size is influenced by the current computational
+region. The extent is based on the vector map
+<em>points_of_interest</em> from the basic North Carolina sample dataset.
+
+<div class="code"><pre>
+g.region vector=points_of_interest res=2000 -pa
+</pre></div>
+
+The hexagonal grid is created as a vector map based on the previously
+selected extent and size of the grid.
+
+<div class="code"><pre>
+v.mkgrid map=hexagons -h
+</pre></div>
+
+The <em><a href="v.vect.stats.html">v.vect.stats</a></em> module
+counts the number of points and does one statistics on a selected
+column (here: <em>elev_m</em>).
+
+<div class="code"><pre>
+v.vect.stats points=points_of_interest areas=hexagons method=average \
+  points_column=elev_m count_column=count stats_column=average
+</pre></div>
+
+User should note that some of the points may be outside the grid
+since the hexagons cannot cover all the area around the edges
+(the computational region extent needs to be enlarged if all points
+should be considered).
+The last command sets the vector map color table to <tt>viridis</tt>
+based on the <tt>count</tt> column.
+
+<div class="code"><pre>
+v.colors map=hexagons use=attr column=average color=viridis
+</pre></div>
+
+<!--
+v.vect.stats points=points_of_interest areas=hexagons method=average \
+  points_column=elev_m count_column=count stats_column=average
+v.vect.stats points=points_of_interest areas=hexagons method=range \
+  points_column=elev_m count_column=count stats_column=range
+v.vect.stats points=points_of_interest areas=hexagons method=stddev \
+  points_column=elev_m count_column=count stats_column=stddev
+
+export GRASS_FONT=LiberationSans-Regular
+
+FILE=v_vect_stats.png
+
+rm $FILE
+
+d.mon cairo out=$FILE
+
+d.frame frame=f1 at=50,100,0,50 -c
+v.colors map=hexagons use=attr column=range color=viridis
+d.vect map=points_of_interest color=black fill_color=black width=1 icon=basic/point size=3
+d.text text="points" at=60,5 size=10 color=black
+
+d.frame frame=f2 at=50,100,50,100 -c
+v.colors map=hexagons use=attr column=count color=viridis
+d.vect map=hexagons where="count > 0"
+d.text text="count" at=60,5 size=10 color=black
+
+d.frame frame=f3 at=0,50,0,50 -c
+v.colors map=hexagons use=attr column=average color=viridis
+d.vect map=hexagons where="count > 0"
+d.text text="average" at=60,5 size=10 color=black
+
+d.frame frame=f4 at=0,50,50,100 -c
+v.colors map=hexagons use=attr column=stddev color=viridis
+d.vect map=hexagons where="count > 0"
+d.text text="stddev" at=60,5 size=10 color=black
+
+d.mon stop=cairo
+mogrify -trim $FILE
+-->
+
+<center>
+<img src="v_vect_stats.png"><br>
+Point statistics in a hexagonal grid (count of points, average of values
+associated with point, standard deviation)
+</center>
+
+
 <h2>SEE ALSO</h2>
 
 <em>

Added: grass/trunk/vector/v.vect.stats/v_vect_stats.png
===================================================================
(Binary files differ)


Property changes on: grass/trunk/vector/v.vect.stats/v_vect_stats.png
___________________________________________________________________
Added: svn:mime-type
   + image/png



More information about the grass-commit mailing list