[GRASS-SVN] r52271 - grass/trunk/raster/r.external
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 1 10:05:46 PDT 2012
Author: mmetz
Date: 2012-07-01 10:05:46 -0700 (Sun, 01 Jul 2012)
New Revision: 52271
Modified:
grass/trunk/raster/r.external/link.c
grass/trunk/raster/r.external/main.c
grass/trunk/raster/r.external/proto.h
Log:
r.external: close GDALDataset; remove r flag: approximate range is not ok
Modified: grass/trunk/raster/r.external/link.c
===================================================================
--- grass/trunk/raster/r.external/link.c 2012-07-01 17:03:53 UTC (rev 52270)
+++ grass/trunk/raster/r.external/link.c 2012-07-01 17:05:46 UTC (rev 52271)
@@ -5,7 +5,7 @@
#include "proto.h"
-void query_band(GDALRasterBandH hBand, const char *output, int exact_range,
+void query_band(GDALRasterBandH hBand, const char *output,
struct Cell_head *cellhd, struct band_info *info)
{
int bGotMin, bGotMax;
@@ -52,7 +52,7 @@
info->range[0] = GDALGetRasterMinimum(hBand, &bGotMin);
info->range[1] = GDALGetRasterMaximum(hBand, &bGotMax);
if(!(bGotMin && bGotMax))
- GDALComputeRasterMinMax(hBand, !exact_range, info->range);
+ GDALComputeRasterMinMax(hBand, 0, info->range);
Rast_init_colors(&info->colors);
Modified: grass/trunk/raster/r.external/main.c
===================================================================
--- grass/trunk/raster/r.external/main.c 2012-07-01 17:03:53 UTC (rev 52270)
+++ grass/trunk/raster/r.external/main.c 2012-07-01 17:05:46 UTC (rev 52271)
@@ -42,7 +42,7 @@
struct Option *input, *source, *output, *band, *title;
} parm;
struct {
- struct Flag *o, *f, *e, *r, *h, *v;
+ struct Flag *o, *f, *e, *h, *v;
} flag;
int min_band, max_band, band;
struct band_info info;
@@ -105,10 +105,6 @@
flag.e->label = _("Extend region extents based on new dataset");
flag.e->description = _("Also updates the default region if in the PERMANENT mapset");
- flag.r = G_define_flag();
- flag.r->key = 'r';
- flag.r->description = _("Require exact range");
-
flag.h = G_define_flag();
flag.h->key = 'h';
flag.h->description = _("Flip horizontally");
@@ -209,13 +205,16 @@
title2 = G_store(title);
}
- query_band(hBand, output2, flag.r->answer, &cellhd, &info);
+ query_band(hBand, output2, &cellhd, &info);
create_map(input, band, output2, &cellhd, &info, title, flip);
G_free(output2);
G_free(title2);
}
+ /* close the GDALDataset to avoid segfault in libgdal */
+ GDALClose(hDS);
+
if (flag.e->answer)
update_default_window(&cellhd);
Modified: grass/trunk/raster/r.external/proto.h
===================================================================
--- grass/trunk/raster/r.external/proto.h 2012-07-01 17:03:53 UTC (rev 52270)
+++ grass/trunk/raster/r.external/proto.h 2012-07-01 17:05:46 UTC (rev 52271)
@@ -21,7 +21,7 @@
};
/* link.c */
-void query_band(GDALRasterBandH, const char *, int,
+void query_band(GDALRasterBandH, const char *,
struct Cell_head *, struct band_info *);
void make_cell(const char *, const struct band_info *);
void make_link(const char *, const char *, int,
More information about the grass-commit
mailing list