Преглед изворни кода

virtual raster: fix embed nulls and stats in metadata

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@73623 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz пре 6 година
родитељ
комит
7ee6c223ed
3 измењених фајлова са 10 додато и 1 уклоњено
  1. 6 0
      lib/raster/get_row.c
  2. 3 0
      raster/r.buildvrt/link.c
  3. 1 1
      raster/r.buildvrt/main.c

+ 6 - 0
lib/raster/get_row.c

@@ -909,6 +909,12 @@ static void get_null_value_row_nomask(int fd, char *flags, int row)
 	    flags[j] = 1;
 	return;
     }
+    if (fcb->vrt) {
+	/* vrt: already done when reading the real maps, no extra NULL values */
+	for (j = 0; j < R__.rd_window.cols; j++)
+	    flags[j] = 0;
+	return;
+    }
 
     if (row != fcb->null_cur_row) {
 	if (!Rast__read_null_bits(fd, row, fcb->null_bits)) {

+ 3 - 0
raster/r.buildvrt/link.c

@@ -115,8 +115,11 @@ void create_map(const struct input *inputs, int num_inputs, const char *output,
 	write_fp_quant(output);
     }
     G_remove_misc("cell_misc", "stats", output);
+#if 0
+    /* does not work with overlapping tiles */
     if (have_stats)
 	Rast_write_rstats(output, ostats);
+#endif
 
     G_verbose_message(_("Creating support files for %s"), output);
     Rast_short_history(output, "virtual", &history);

+ 1 - 1
raster/r.buildvrt/main.c

@@ -285,7 +285,7 @@ int main(int argc, char *argv[])
 	    }
 	}
 	if (have_stats && 
-	    Rast_read_rstats(inputs[0].name, inputs[0].mapset, &rstats) == 1) {
+	    Rast_read_rstats(p->name, p->mapset, &rstats) == 1) {
 	    ostats.sum += rstats.sum;
 	    ostats.sumsq += rstats.sumsq;
 	    ostats.count += rstats.count;