Skip to content

Commit

Permalink
i.ortho.target: Rename location and mapset options to target (#3131)
Browse files Browse the repository at this point in the history
i.ortho.target has option target_location and mapset_location. This renames them to target_project and target_mapset, so the new names are consistent. While mapsets are in locations (projects), there seems to be no reason for the word location in mapset_location because it is G_OPT_M_MAPSET.

This also includes change for g.gui.image2target which uses G_OPT_M_LOCATION with a custom name target_location, now renamed target_project. Both old and new names are consistent with target_project in i.ortho.target.


Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
  • Loading branch information
wenzeslaus and petrasovaa committed Mar 22, 2024
1 parent ff6582e commit cb37ba7
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 61 deletions.
6 changes: 3 additions & 3 deletions gui/wxpython/image2target/g.gui.image2target.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
# %end

##%option G_OPT_M_LOCATION
##% key: source_location
##% label: The name of the source location (has no projection)
##% description: The name of the source location (has no projection)
##% key: source_project
##% label: The name of the source project (has no projection)
##% description: The source project (location) has no CRS
###% section: source
##% required: yes
##%end
Expand Down
3 changes: 2 additions & 1 deletion imagery/i.ortho.photo/i.ortho.camera/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ int main(int argc, char *argv[])

I_put_group_camera(group, camera);

G_message(_("Group [%s] in location [%s] mapset [%s] now uses camera "
G_message(_("Group [%s] in project (location) [%s] mapset [%s] now "
"uses camera "
"file [%s]"),
group, location, mapset, camera);
}
Expand Down
16 changes: 9 additions & 7 deletions imagery/i.ortho.photo/i.ortho.elev/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int main(int argc, char *argv[])

loc_opt = G_define_standard_option(G_OPT_M_LOCATION);
loc_opt->required = NO;
loc_opt->description = _("Name of the target location");
loc_opt->description = _("Name of the target project (location)");

mapset_opt = G_define_standard_option(G_OPT_M_MAPSET);
mapset_opt->required = NO;
Expand Down Expand Up @@ -138,7 +138,8 @@ int main(int argc, char *argv[])

sprintf(buf, "%s/%s", G_gisdbase(), location);
if (access(buf, 0) != 0) {
G_fatal_error(_("Target location [%s] not found\n"), location);
G_fatal_error(_("Target project (location) [%s] not found\n"),
location);
}

/*Report the contents of the ELEVATION file as in the GROUP */
Expand Down Expand Up @@ -224,13 +225,14 @@ int main(int argc, char *argv[])
I_put_group_elev(group, elev_opt->answer, mapset_elev, location_elev,
math_exp, units, nd);

G_message(_("Group [%s] in location [%s] mapset [%s] now uses "
"elevation map [%s]"),
group, G_location(), G_mapset(), elev_opt->answer);
G_message(
_("Group [%s] in project (location) [%s] mapset [%s] now uses "
"elevation map [%s]"),
group, G_location(), G_mapset(), elev_opt->answer);
}
else {
G_fatal_error(_("Mapset [%s] in target location [%s] - %s "), mapset,
location,
G_fatal_error(_("Mapset [%s] in target project (location) [%s] - %s "),
mapset, location,
stat == 0 ? _("permission denied\n") : _("not found\n"));
}

Expand Down
44 changes: 22 additions & 22 deletions imagery/i.ortho.photo/i.ortho.photo/i.ortho.photo.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h2>DESCRIPTION</h2>
<ol>
<li value=1>Create/Modify imagery group to be orthorectified:
<a href="i.group.html">i.group</a></li>
<li>Select/Modify target location and mapset for orthorectification:
<li>Select/Modify target project (formerly known as location) and mapset for orthorectification:
<a href="i.ortho.target.html">i.ortho.target</a></li>
<li>Select/Modify target elevation model used for orthorectification:
<a href="i.ortho.elev.html">i.ortho.elev</a></li>
Expand Down Expand Up @@ -69,26 +69,26 @@ <h2>EXAMPLE</h2>
<a href="i_ortho_photo_step1.png">
<img src="i_ortho_photo_step1.png" width="600" height="512" alt="i.ortho.photo example" border="0">
</a><br>
<i>Example of an input oblique image in a source location</i>
<i>Example of an input oblique image in a source project</i>
</div>

<p>
To ortho-rectify aerial images the user has to follow the menu options
step by step. Alternatively, all the steps can be performed separately
by running the corresponding modules.
<p>
The aerial photos shall be stored in a <b>source location</b> - a general
The aerial photos shall be stored in a <b>source project</b> - a general
Cartesian coordinate system (XY). Digital elevation model and a map reference
(topo sheet or other map used for ground control point matching) shall
be stored in a <b>target location</b> in a real-world coordinate system
be stored in a <b>target project</b> in a real-world coordinate system
(e.g. ETRS33).
<p>
The steps to follow are described below:
<ol>
<li><em>Create/Modify imagery group to be orthorectified:
<a href="i.group.html">i.group</a></em>
<p>
This step is to be run in the <b>source location</b>.
This step is to be run in the <b>source project</b>.
<p>
In this first step an imagery group of aerial images for ortho-rectification
is created or modified. The current imagery group is displayed at the top
Expand All @@ -105,18 +105,18 @@ <h2>EXAMPLE</h2>
</pre></div>
</li>

<li><em>Select/Modify target location and mapset for orthorectification:
<li><em>Select/Modify target project and mapset for orthorectification:
<a href="i.ortho.target.html">i.ortho.target</a></em>
<p>
This step is to be run in the <b>source location</b>.
This step is to be run in the <b>source project</b>.
<p>
The target location and mapset may be selected or modified in Step 2.
You will be prompted for the names of the projected target location and
The target project and mapset may be selected or modified in Step 2.
You will be prompted for the names of the projected target project and
mapset where the ortho-rectified raster maps will reside. The target
location is also the location from which the elevation model (raster
project is also the project from which the elevation model (raster
map) will be selected (see Step 3). In Step 2, a new file
<em>mapset/group/name_of_group/<b>TARGET</b></em>
is created contatining the names of target location and mapset.
is created contatining the names of target project and mapset.

<div class="code"><pre>
ETRS_33N
Expand All @@ -127,17 +127,17 @@ <h2>EXAMPLE</h2>
<li><em>Select/Modify target elevation model used for orthorectification:
<a href="i.ortho.elev.html">i.ortho.elev</a></em>
<p>
This step is to be run in the <b>source location</b>.
This step is to be run in the <b>source project</b>.
<p>
Step 3 allows you to select the raster map from the target location to be
Step 3 allows you to select the raster map from the target project to be
used as the elevation model. The elevation model is required for both the
computation of photo-to-target parameters (Step 6) and for the
ortho-rectification of the imagery group files (Step 8).
The raster map selected for the elevation model should cover the entire
area of the image group to be ortho-rectified. DTED and DEM files are
suitable for use as elevation model in the ortho-rectification program.
In Step 3 you will be prompted for the name of the raster map in the
target location that you want to use as the elevation model. As a result
target project that you want to use as the elevation model. As a result
of this step, a new file <em>mapset/group/name_of_group/<b>ELEVATION</b></em>
is created contatining the name and mapset of the chosen DEM.

Expand All @@ -154,7 +154,7 @@ <h2>EXAMPLE</h2>
<li><em> Create/Modify camera file of imagery group:
<a href="i.ortho.camera.html">i.ortho.camera</a></em>
<p>
This step is to be run in the <b>source location</b>.
This step is to be run in the <b>source project</b>.
<p>
In Step 4 you may select or create a camera reference file that will be
used with the current imagery group. A camera reference file contains
Expand Down Expand Up @@ -185,7 +185,7 @@ <h2>EXAMPLE</h2>
<li><em> Compute image-to-photo transformation:
<a href="g.gui.photo2image.html">g.gui.photo2image</a></em>
<p>
This step is to be run in the <b>source location</b>.
This step is to be run in the <b>source project</b>.
<p>
The scanned image to photo coordinate transformation parameters, i.e. the
"interior orientation", is computed in Step 5. In this interactive step you
Expand Down Expand Up @@ -220,7 +220,7 @@ <h2>EXAMPLE</h2>
<li><em> Initialize parameters of camera:
<a href="i.ortho.init.html">i.ortho.init</a></em>
<p>
This step is to be run in the <b>source location</b>.
This step is to be run in the <b>source project</b>.
<p>
In Step 6, initial camera exposure station parameters and initial variances
may be selected or modified.
Expand Down Expand Up @@ -267,7 +267,7 @@ <h2>EXAMPLE</h2>
<li><em> Compute ortho-rectification parameters from ground control points:
<a href="g.gui.image2target.html">g.gui.image2target</a></em>
<p>
This step is to be run in the <b>target location</b>.
This step is to be run in the <b>target project</b>.
<p>
The photo to target transformation parameters, i.e. the "exterior
orientation", is computed in Step 7. In this interactive step, control
Expand All @@ -276,7 +276,7 @@ <h2>EXAMPLE</h2>
Reasonable rectification results can be obtained with around twelve
control points well distributed over the image.
In this step, a new file <em>mapset/group/name_of_group/<b>CONTROL_POINTS</b></em>
is created, contatining a list of pairs of coordinates of ground control
is created, containing a list of pairs of coordinates of ground control
points in photo and target coordinate systems.

<div class="code"><pre>
Expand Down Expand Up @@ -306,13 +306,13 @@ <h2>EXAMPLE</h2>
<li><em> Ortho-rectify imagery group:
<a href="i.ortho.rectify.html">i.ortho.rectify</a></em>
<p>
This step is to be run in the <b>source location</b>.
This step is to be run in the <b>source project</b>.
<p>
Step 8 is used to perform the actual image ortho-rectification after all
of the transformation parameters have been computed. Ortho-rectified raster
files will be created in the target location for each selected imagery
files will be created in the target project for each selected imagery
group file. You may select either the current window in the target
location or the minimal bounding window for the ortho-rectified image.
project or the minimal bounding window for the ortho-rectified image.

<div align="center" style="margin: 10px">
<a href="i_ortho_photo_step8.png">
Expand Down
10 changes: 5 additions & 5 deletions imagery/i.ortho.photo/i.ortho.rectify/i.ortho.rectify.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <H2>DESCRIPTION</H2>
the image. The result is an image with a standard map coordinate system,
compensated for relief distortions and photographic tilt. Upon completion of
the program the rectified image is deposited in a previously targeted GRASS
LOCATION.
project (location).
<p>
Images can be resampled with various different interpolation methods:
nearest neighbor assignment, bilinear and bicubic interpolation. The
Expand All @@ -24,7 +24,7 @@ <H2>DESCRIPTION</H2>
the speed of the computer, the number files, and the size and resolution
of the selected window.
<p>
The rectified image will be located in the target LOCATION when the program
The rectified image will be located in the target project when the program
is completed. The original unrectified files are not modified or removed.
<p>
The optional <em>angle</em> output holds the camera angle in degrees to
Expand Down Expand Up @@ -57,13 +57,13 @@ <H4>Interactive mode</H4>
produced and if yes, what should be its name.
<p>
After that you are asked if overwriting existing maps in the target
location and mapset should be allowed.
project and mapset should be allowed.
<p>
The next prompt asks you to select one of two windows:
<p>
<pre>
Please select one of the following options
1. Use the current window in the target location
1. Use the current window in the target project
2. Determine the smallest window which covers the image
&gt;
</pre>
Expand All @@ -73,7 +73,7 @@ <H4>Interactive mode</H4>
<em>i.photo.rectify</em> will only rectify that portion of the
image that occurs within the chosen window. Only that portion will be
relocated in the target database. It is therefore important to check the
current window in the target LOCATION if choice number one is selected.
current window in the target project if choice number one is selected.
<p>
Next you are asked to select an interpolation method.
<pre>
Expand Down
15 changes: 8 additions & 7 deletions imagery/i.ortho.photo/i.ortho.rectify/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ int main(int argc, char *argv[])

c = G_define_flag();
c->key = 'c';
c->description = _("Use current region settings in target location "
"(def.=calculate smallest area)");
c->description =
_("Use current region settings in target project (location) "
"(def.=calculate smallest area)");

a = G_define_flag();
a->key = 'a';
Expand Down Expand Up @@ -179,7 +180,7 @@ int main(int argc, char *argv[])

/* determine the number of files in this group */
if (!I_get_group_ref(group.name, &group.group_ref)) {
G_warning(_("Location: %s"), G_location());
G_warning(_("Project (location): %s"), G_location());
G_warning(_("Mapset: %s"), G_mapset());
G_fatal_error(_("Could not read REF file for group <%s>"), group.name);
}
Expand Down Expand Up @@ -288,17 +289,17 @@ int main(int argc, char *argv[])

if (G_find_raster2(result, G_mapset())) {
G_warning(_("The following raster map already exists in"));
G_warning(_("target LOCATION %s, MAPSET %s:"), G_location(),
G_mapset());
G_warning(_("target project (location) %s, mapset %s:"),
G_location(), G_mapset());
G_warning("<%s>", result);
G_fatal_error(_("Orthorectification cancelled."));
}
}
if (angle->answer) {
if (G_find_raster2(angle->answer, G_mapset())) {
G_warning(_("The following raster map already exists in"));
G_warning(_("target LOCATION %s, MAPSET %s:"), G_location(),
G_mapset());
G_warning(_("target project (location) %s, mapset %s:"),
G_location(), G_mapset());
G_warning("<%s>", angle->answer);
G_fatal_error(_("Orthorectification cancelled."));
}
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.ortho.photo/i.ortho.rectify/rectify.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ int rectify(struct Ortho_Image_Group *group, char *name, char *mapset,

Rast_close(infd); /* (pmx) 17 april 2000 */

G_message(_("Rectify <%s@%s> (location <%s>)"), name, mapset, G_location());
G_message(_("Rectify <%s@%s> (project <%s>)"), name, mapset, G_location());
select_target_env();
G_set_window(&target_window);
G_message(_("into <%s@%s> (location <%s>) ..."), result, G_mapset(),
G_message(_("into <%s@%s> (project <%s>) ..."), result, G_mapset(),
G_location());

nrows = target_window.rows;
Expand Down
5 changes: 3 additions & 2 deletions imagery/i.ortho.photo/i.ortho.rectify/target.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int get_target(char *group)

sprintf(buf, "%s/%s", G_gisdbase(), location);
if (access(buf, 0) != 0) {
sprintf(buf, _("Target location <%s> not found"), location);
sprintf(buf, _("Target project (location) <%s> not found"), location);
goto error;
}
select_target_env();
Expand All @@ -28,7 +28,8 @@ int get_target(char *group)
select_current_env();
return 1;
}
sprintf(buf, _("Mapset <%s> in target location <%s> - "), mapset, location);
sprintf(buf, _("Mapset <%s> in target project (location) <%s> - "), mapset,
location);
strcat(buf, stat == 0 ? _("permission denied") : _("not found"));
error:
strcat(buf, "\n");
Expand Down
2 changes: 1 addition & 1 deletion imagery/i.ortho.photo/i.ortho.target/i.ortho.target.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<H2>DESCRIPTION</H2>

<em>i.ortho.target</em> sets the image group target location and mapset
<em>i.ortho.target</em> sets the image group target project (location) and mapset
<p>

<H2>SEE ALSO</H2>
Expand Down
19 changes: 10 additions & 9 deletions imagery/i.ortho.photo/i.ortho.target/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ int main(int argc, char *argv[])
group_opt->description = _("Name of imagery group for ortho-rectification");

location_opt = G_define_standard_option(G_OPT_M_LOCATION);
location_opt->key = "target_location";
location_opt->key = "target_project";
location_opt->required = YES;
location_opt->description =
_("Name of target location for ortho-rectification");
_("Name of target project (location) for ortho-rectification");

mapset_opt = G_define_standard_option(G_OPT_M_MAPSET);
mapset_opt->key = "mapset_location";
mapset_opt->key = "target_mapset";
mapset_opt->required = YES;
mapset_opt->description =
_("Name of target mapset for ortho-rectification");
Expand All @@ -77,23 +77,24 @@ int main(int argc, char *argv[])
G_setenv_nogisrc("LOCATION_NAME", target_location);
stat = G_mapset_permissions(target_mapset);
if (stat != 1) {
G_fatal_error(_("Unable to access target location/mapset %s/%s"),
G_fatal_error(_("Unable to access target project/mapset %s/%s"),
target_location, target_mapset);
}

G_setenv_nogisrc("MAPSET", target_mapset);
G_get_window(&target_window);
if (target_window.proj == PROJECTION_XY)
G_fatal_error(
_("Target locations with XY (unreferenced) are not supported"));
G_fatal_error(_("Target projects (locations) with XY (unreferenced) "
"are not supported"));
else if (target_window.proj == PROJECTION_LL)
G_fatal_error(_("Target locations with lon/lat are not supported"));
G_fatal_error(
_("Target projects (locations) with lon/lat are not supported"));

G_switch_env();
I_put_target(group, target_location, target_mapset);

G_message(_("Group [%s] targeted for location [%s], mapset [%s]"), group,
target_location, target_mapset);
G_message(_("Group [%s] targeted for project (location) [%s], mapset [%s]"),
group, target_location, target_mapset);

exit(EXIT_SUCCESS);
}

0 comments on commit cb37ba7

Please sign in to comment.