From cc8946ead55d5be96ed6e140af305059e95f0f0a Mon Sep 17 00:00:00 2001 From: Anna Petrasova Date: Tue, 9 Apr 2024 14:46:00 -0400 Subject: [PATCH] v.in.ogr: rename option location to project --- lib/gis/renamed_options | 1 + scripts/v.import/v.import.py | 14 +++++++------- vector/v.in.ogr/main.c | 20 ++++++++++---------- vector/v.in.ogr/proj.c | 30 +++++++++++++++--------------- vector/v.in.ogr/v.in.ogr.html | 2 +- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/lib/gis/renamed_options b/lib/gis/renamed_options index e996126a9b0..1dc180c377a 100644 --- a/lib/gis/renamed_options +++ b/lib/gis/renamed_options @@ -730,3 +730,4 @@ r.proj|location:project i.ortho.elev|location:project g.download.location|location:project v.proj|location:project +v.in.ogr|location:project diff --git a/scripts/v.import/v.import.py b/scripts/v.import/v.import.py index 618a5c99eca..4748bcfc223 100755 --- a/scripts/v.import/v.import.py +++ b/scripts/v.import/v.import.py @@ -93,8 +93,8 @@ # %end # %flag # % key: o -# % label: Override projection check (use current location's projection) -# % description: Assume that the dataset has the same projection as the current location +# % label: Override projection check (use current project's projection) +# % description: Assume that the dataset has the same projection as the current project # %end import sys @@ -240,7 +240,7 @@ def main(): # make sure target is not xy if grass.parse_command("g.proj", flags="g")["name"] == "xy_location_unprojected": grass.fatal( - _("Coordinate reference system not available for current location <%s>") + _("Coordinate reference system not available for current project <%s>") % tgtloc ) @@ -261,7 +261,7 @@ def main(): tgtsrs = grass.read_command("g.proj", flags="j", quiet=True) # create temp location from input without import - grass.verbose(_("Creating temporary location for <%s>...") % OGRdatasource) + grass.verbose(_("Creating temporary project for <%s>...") % OGRdatasource) try: if OGRdatasource.lower().endswith("gml"): try: @@ -277,7 +277,7 @@ def main(): grass.run_command( "v.in.ogr", input=OGRdatasource, - location=TMPLOC, + project=TMPLOC, flags="i", quiet=True, overwrite=overwrite, @@ -285,7 +285,7 @@ def main(): ) except CalledModuleError: grass.fatal( - _("Unable to create location from OGR datasource <%s>") % OGRdatasource + _("Unable to create project from OGR datasource <%s>") % OGRdatasource ) # switch to temp location @@ -330,7 +330,7 @@ def main(): overwrite=overwrite, ) except CalledModuleError: - grass.fatal(_("Unable to reproject to source location")) + grass.fatal(_("Unable to reproject to source project")) # set region from region vector grass.run_command("g.region", res="1") diff --git a/vector/v.in.ogr/main.c b/vector/v.in.ogr/main.c index 730d8fa64cd..edd188b8989 100644 --- a/vector/v.in.ogr/main.c +++ b/vector/v.in.ogr/main.c @@ -213,7 +213,7 @@ int main(int argc, char *argv[]) G_add_keyword(_("topology")); G_add_keyword(_("geometry")); G_add_keyword(_("snapping")); - G_add_keyword(_("create location")); + G_add_keyword(_("create project")); module->description = _("Imports vector data into a GRASS vector map using OGR library."); @@ -307,10 +307,10 @@ int main(int argc, char *argv[]) param.snap->description = _("'-1' for no snap"); param.outloc = G_define_option(); - param.outloc->key = "location"; + param.outloc->key = "project"; param.outloc->type = TYPE_STRING; param.outloc->required = NO; - param.outloc->description = _("Name for new location to create"); + param.outloc->description = _("Name for new project (location) to create"); param.outloc->key_desc = "name"; param.outloc->guisection = _("Output"); @@ -377,9 +377,9 @@ int main(int argc, char *argv[]) flag.over = G_define_flag(); flag.over->key = 'o'; flag.over->label = - _("Override projection check (use current location's projection)"); + _("Override projection check (use current project's projection)"); flag.over->description = _("Assume that the dataset has the same " - "projection as the current location"); + "projection as the current project"); flag.proj = G_define_flag(); flag.proj->key = 'j'; @@ -406,9 +406,9 @@ int main(int argc, char *argv[]) flag.no_import = G_define_flag(); flag.no_import->key = 'i'; - flag.no_import->description = _( - "Create the location specified by the \"location\" parameter and exit." - " Do not import the vector data."); + flag.no_import->description = + _("Create the project specified by the \"project\" parameter and exit." + " Do not import the vector data."); flag.no_import->guisection = _("Output"); /* The parser checks if the map already exists in current mapset, this is @@ -715,7 +715,7 @@ int main(int argc, char *argv[]) /* create spatial filters */ if (param.outloc->answer && flag.region->answer) { - G_warning(_("When creating a new location, the current region " + G_warning(_("When creating a new project, the current region " "can not be used as spatial filter, disabling")); flag.region->answer = 0; } @@ -1972,7 +1972,7 @@ int main(int argc, char *argv[]) if (strcmp(G_mapset(), "PERMANENT") == 0) { G_put_element_window(&cur_wind, "", "DEFAULT_WIND"); - G_message(_("Default region for this location updated")); + G_message(_("Default region for this project updated")); } G_put_window(&cur_wind); G_message(_("Region for the current mapset updated")); diff --git a/vector/v.in.ogr/proj.c b/vector/v.in.ogr/proj.c index ad7b6363c4f..4830b1be85d 100644 --- a/vector/v.in.ogr/proj.c +++ b/vector/v.in.ogr/proj.c @@ -298,14 +298,14 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer, * real SRS has not been recognized or is missing */ if (proj_trouble) { G_fatal_error(_("Unable to convert input map projection to GRASS " - "format; cannot create new location.")); + "format; cannot create new project.")); } else { if (0 != G_make_location_crs(outloc, cellhd, proj_info, proj_units, srid, wkt)) { - G_fatal_error(_("Unable to create new location <%s>"), outloc); + G_fatal_error(_("Unable to create new project <%s>"), outloc); } - G_message(_("Location <%s> created"), outloc); + G_message(_("Project <%s> created"), outloc); G_unset_window(); /* new location, projection, and window */ G_get_window(cellhd); @@ -365,13 +365,13 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer, int i_value; strcpy(error_msg, _("Projection of dataset does not" - " appear to match current location.\n\n")); + " appear to match current project.\n\n")); /* TODO: output this info sorted by key: */ if (loc_wind.proj != cellhd->proj || err != -2) { /* error in proj_info */ if (loc_proj_info != NULL) { - strcat(error_msg, _("Location PROJ_INFO is:\n")); + strcat(error_msg, _("Project PROJ_INFO is:\n")); for (i_value = 0; i_value < loc_proj_info->nitems; i_value++) sprintf(error_msg + strlen(error_msg), "%s: %s\n", @@ -380,22 +380,22 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer, strcat(error_msg, "\n"); } else { - strcat(error_msg, _("Location PROJ_INFO is:\n")); + strcat(error_msg, _("Project PROJ_INFO is:\n")); if (loc_wind.proj == PROJECTION_XY) sprintf(error_msg + strlen(error_msg), - "Location proj = %d (unreferenced/unknown)\n", + "Project proj = %d (unreferenced/unknown)\n", loc_wind.proj); else if (loc_wind.proj == PROJECTION_LL) sprintf(error_msg + strlen(error_msg), - "Location proj = %d (lat/long)\n", + "Project proj = %d (lat/long)\n", loc_wind.proj); else if (loc_wind.proj == PROJECTION_UTM) sprintf(error_msg + strlen(error_msg), - "Location proj = %d (UTM), zone = %d\n", + "Project proj = %d (UTM), zone = %d\n", loc_wind.proj, cellhd->zone); else sprintf(error_msg + strlen(error_msg), - "Location proj = %d (unknown), zone = %d\n", + "Project proj = %d (unknown), zone = %d\n", loc_wind.proj, cellhd->zone); } @@ -469,7 +469,7 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer, else { /* error in proj_units */ if (loc_proj_units != NULL) { - strcat(error_msg, "Location PROJ_UNITS is:\n"); + strcat(error_msg, "Project PROJ_UNITS is:\n"); for (i_value = 0; i_value < loc_proj_units->nitems; i_value++) sprintf(error_msg + strlen(error_msg), "%s: %s\n", @@ -490,10 +490,10 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer, strcat(error_msg, _("\nIn case of no significant differences " "in the projection definitions," " use the -o flag to ignore them and use" - " current location definition.\n")); - strcat(error_msg, _("Consider generating a new location from " + " current project definition.\n")); + strcat(error_msg, _("Consider generating a new project from " "the input dataset using " - "the 'location' parameter.\n")); + "the 'project' parameter.\n")); } if (check_only) @@ -511,7 +511,7 @@ void check_projection(struct Cell_head *cellhd, GDALDatasetH hDS, int layer, msg_fn = G_message; else msg_fn = G_verbose_message; - msg_fn(_("Projection of input dataset and current location " + msg_fn(_("Projection of input dataset and current project " "appear to match")); if (check_only) { GDALClose(hDS); diff --git a/vector/v.in.ogr/v.in.ogr.html b/vector/v.in.ogr/v.in.ogr.html index 145baec1c34..00d78764599 100644 --- a/vector/v.in.ogr/v.in.ogr.html +++ b/vector/v.in.ogr/v.in.ogr.html @@ -92,7 +92,7 @@

Location Creation

definition, it is possible to have v.in.ogr automatically create a new location based on the projection and extents of the file being read. This is accomplished by passing the name to be used for -the new location via the location parameter. Upon completion +the new location via the project parameter. Upon completion of the command, a new location will have been created (with only a PERMANENT mapset), and the vector map will have been imported with the indicated output name into the PERMANENT mapset.