Przeglądaj źródła

sql manual: Example of conditions added

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65872 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 9 lat temu
rodzic
commit
855e79ea6a
3 zmienionych plików z 23 dodań i 2 usunięć
  1. 12 0
      lib/db/sqlp/sql.html
  2. 7 0
      vector/v.delaunay/v.delaunay.html
  3. 4 2
      vector/v.mkgrid/main.c

+ 12 - 0
lib/db/sqlp/sql.html

@@ -187,6 +187,18 @@ v.db.update mygeodetic_pts col=zval \
 v.db.update vectormap column=column3 qcolumn="column1 || column2"
 </pre></div>
 
+<h3>Example of conditions</h3>
+
+Conditions (like if statements) are usually written as CASE statement in SQL:
+
+<div class="code"><pre>
+v.db.update vectormap column=species qcolumn="CASE WHEN col1 &gt;= 12 THEN cat else NULL end"
+
+# a more complex example with nested conditions
+v.db.update vectormap column=species qcolumn="CASE WHEN col1 &gt;= 1 THEN cat WHEN row = 13 then 0 ELSE NULL end"
+</pre></div>
+
+
 <h2>SEE ALSO</h2>
 
 <em>

+ 7 - 0
vector/v.delaunay/v.delaunay.html

@@ -15,6 +15,13 @@ Commands used with the North Carolina dataset to create the above figure (subset
 <div class="code"><pre>
 g.region n=220750 s=219950 w=638300 e=639000 -p
 v.delaunay input=elev_lid792_randpts output=elev_lid792_randpts_delaunay
+
+
+  696  v.delaunay input=elev_lid792_bepts output=elev_lid792_bepts_tin 
+  697  v.colors elev_lid792_bepts_tin color=srtm_plus
+  698  d.erase 
+  699  d.vect elev_lid792_bepts_tin
+
 </pre></div>
 
 

+ 4 - 2
vector/v.mkgrid/main.c

@@ -323,7 +323,9 @@ int main(int argc, char *argv[])
 	if (grid_info.north - grid_info.south < 3 * grid_info.rstep) {
 	    G_fatal_error(_("Please use a higher resolution or a larger region"));
 	}
-
+G_debug(0,"grid_info.num_vect_rows %d", grid_info.num_vect_rows);
+G_debug(0,"grid_info.num_rows %d", grid_info.num_rows);
+G_debug(0,"grid_info.num_vect_rows / 2.0 + 0.5: %f (int) %d", (grid_info.num_vect_rows / 2.0 + 0.5), (int)(grid_info.num_vect_rows / 2.0 + 0.5));
 	if ((int)(grid_info.num_vect_rows / 2.0 + 0.5) != grid_info.num_rows)
 	    G_message(_("The number of rows has been adjusted from %d to %d"),
 	              grid_info.num_rows, (int)(grid_info.num_vect_rows / 2.0 + 0.5));
@@ -366,7 +368,7 @@ int main(int argc, char *argv[])
 	    }
 	}
     }
-    else {
+    else { /* squares and rectangles */
 	if (grid_info.width != grid_info.height) {
 	    G_important_message(_("The rectangles will be asymmetrical."));
 	}