[GRASS-SVN] r42035 - grass/trunk/raster/r.external
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Apr 26 13:16:26 EDT 2010
Author: glynn
Date: 2010-04-26 13:16:25 -0400 (Mon, 26 Apr 2010)
New Revision: 42035
Modified:
grass/trunk/raster/r.external/Makefile
grass/trunk/raster/r.external/main.c
Log:
Create imagery group for multiple bands (bug #1043)
Modified: grass/trunk/raster/r.external/Makefile
===================================================================
--- grass/trunk/raster/r.external/Makefile 2010-04-26 17:15:30 UTC (rev 42034)
+++ grass/trunk/raster/r.external/Makefile 2010-04-26 17:16:25 UTC (rev 42035)
@@ -2,8 +2,8 @@
PGM = r.external
-LIBES = $(GPROJLIB) $(RASTERLIB) $(GISLIB) $(GDALLIBS) $(MATHLIB)
-DEPENDENCIES = $(GPROJDEP) $(RASTERDEP) $(GISDEP)
+LIBES = $(GPROJLIB) $(RASTERLIB) $(GISLIB) $(GDALLIBS) $(MATHLIB) $(IMAGERYLIB)
+DEPENDENCIES = $(GPROJDEP) $(RASTERDEP) $(GISDEP) $(IMAGERYDEP)
EXTRA_INC = $(PROJINC) $(GDALCFLAGS)
include $(MODULE_TOPDIR)/include/Make/Module.make
Modified: grass/trunk/raster/r.external/main.c
===================================================================
--- grass/trunk/raster/r.external/main.c 2010-04-26 17:15:30 UTC (rev 42034)
+++ grass/trunk/raster/r.external/main.c 2010-04-26 17:16:25 UTC (rev 42035)
@@ -496,8 +496,6 @@
Rast_put_cell_title(output, title);
G_message(_("<%s> created"), output);
-
- return;
}
int main(int argc, char *argv[])
@@ -517,6 +515,7 @@
int min_band, max_band, band;
struct band_info info;
int flip;
+ struct Ref reference;
G_gisinit(argv[0]);
@@ -645,6 +644,12 @@
G_verbose_message(_("Proceeding with import..."));
+ if (max_band > min_band) {
+ if (I_find_group(output) == 1)
+ G_warning(_("Imagery group <%s> already exists and will be overwritten."), output);
+ I_init_group_ref(&reference);
+ }
+
for (band = min_band; band <= max_band; band++) {
char *output2, *title2 = NULL;
@@ -658,6 +663,8 @@
G_asprintf(&output2, "%s.%d", output, band);
if (title)
G_asprintf(&title2, "%s (band %d)", title, band);
+ G_debug(1, "Adding raster map <%s> to group <%s>", output2, output);
+ I_add_file_to_group_ref(output2, G_mapset(), &reference);
}
else {
output2 = G_store(output);
@@ -675,6 +682,13 @@
if (flag_e->answer)
update_default_window(&cellhd);
+ /* Create the imagery group if multiple bands are imported */
+ if (max_band > min_band) {
+ I_put_group_ref(output, &reference);
+ I_put_group(output);
+ G_message(_("Imagery group <%s> created"), output);
+ }
+
G_done_msg(" ");
exit(EXIT_SUCCESS);
More information about the grass-commit
mailing list