5
#include <grass/glocale.h>
7
#include "local_proto.h"
9
void create_location(char *location)
13
ret = G_make_location(location, &cellhd, projinfo, projunits);
15
G_message(_("Location <%s> created"), location);
17
G_fatal_error(_("Unable to create location <%s>: %s"),
18
location, strerror(errno));
20
G_fatal_error(_("Unable to create projection files: %s"),
23
/* Shouldn't happen */
24
G_fatal_error(_("Unable to create location <%s>"), location);
26
G_message(_("You can switch to the new location by\n`%s=%s`"),
27
"g.mapset mapset=PERMANENT location", location);
30
void modify_projinfo()
32
const char *mapset = G_mapset();
33
struct Cell_head old_cellhd;
35
if (strcmp(mapset, "PERMANENT") != 0)
36
G_fatal_error(_("You must select the PERMANENT mapset before updating the "
37
"current location's projection (current mapset is <%s>)"),
40
/* Read projection information from current location first */
41
G_get_default_window(&old_cellhd);
45
/* Write out the PROJ_INFO, and PROJ_UNITS if available. */
46
if (projinfo != NULL) {
47
G_file_name(path, "", "PROJ_INFO", "PERMANENT");
48
G_write_key_value_file(path, projinfo);
51
if (projunits != NULL) {
52
G_file_name(path, "", "PROJ_UNITS", "PERMANENT");
53
G_write_key_value_file(path, projunits);
56
if ((old_cellhd.zone != cellhd.zone) ||
57
(old_cellhd.proj != cellhd.proj)) {
58
/* Recreate the default, and current window files if projection
59
* number or zone have changed */
60
G_put_element_window(&cellhd, "", "DEFAULT_WIND");
61
G_put_element_window(&cellhd, "", "WIND");
62
G_message(_("Default region was updated to the new projection, but if you have "
63
"multiple mapsets `g.region -d` should be run in each to update the "
64
"region from the default"));
66
G_important_message(_("Projection information updated"));