3
#include <grass/imagery.h>
5
#include "local_proto.h"
7
/* read the target for the group and cast it into the alternate GRASS env */
22
elev_layer = (char *)G_malloc(40 * sizeof(char));
23
mapset_elev = (char *)G_malloc(40 * sizeof(char));
25
/*fprintf (stderr,"Looking for target location\n"); */
27
if (!I_get_target(group.name, location, mapset)) {
28
sprintf(buf, "Target information missing for group [%s]\n",
34
fprintf (stderr,"target location: %s\n", location);
35
fprintf (stderr,"target mapset: %s\n", mapset);
36
fprintf (stderr,"Checking target access\n");
39
sprintf(buf, "%s/%s", G_gisdbase(), location);
40
if (access(buf, 0) != 0) {
41
sprintf(buf, "Target location [%s] not found\n", location);
45
G__setenv("LOCATION_NAME", location);
46
stat = G__mapset_permissions(mapset);
48
G__setenv("MAPSET", mapset);
49
G__create_alt_search_path();
51
G__switch_search_path();
54
/* get the block elevation layer raster map in target location */
57
fprintf (stderr,"Looking for elevation file in block: %s\n", block.name);
60
/* Return the elev name from the group file ELEVATION */
61
if (!I_get_group_elev(group.name, elev_layer, mapset_elev,
62
tl, math_exp, units, nd)) {
63
sprintf(buf, "Elevation information missing.for group [%s] \n",
69
fprintf (stderr,"Block elevation: %s in %s\n", elev_layer, mapset_elev);
74
sprintf(buf, "Mapset [%s] in target location [%s] - ", mapset, location);
75
strcat(buf, stat == 0 ? "permission denied\n" : "not found\n");
81
strcat (buf, "Please run i.target for block ");
82
strcat (buf, block.name);
87
int select_current_env(void)
91
G__switch_search_path();
98
int select_target_env(void)
100
if (which_env != 1) {
102
G__switch_search_path();