17 #include <grass/gis.h> 52 struct Cell_head *wind,
53 const struct Key_Value *proj_info,
54 const struct Key_Value *proj_units)
63 sprintf(path,
"%s/%s",
G_gisdbase(), location_name);
68 sprintf(path,
"%s/%s/%s",
G_gisdbase(), location_name,
"PERMANENT");
82 if (proj_info !=
NULL) {
87 if (proj_units !=
NULL) {
113 const struct Key_Value *proj_units1,
114 const struct Key_Value *proj_info2,
115 const struct Key_Value *proj_units2)
117 const char *proj1, *proj2;
119 if (proj_info1 ==
NULL && proj_info2 ==
NULL)
126 if (proj_info1 ==
NULL || proj_info2 ==
NULL)
132 if (proj1 ==
NULL || proj2 ==
NULL || strcmp(proj1, proj2))
139 if (proj_units1 ==
NULL && proj_units2 ==
NULL)
142 if (proj_units1 ==
NULL || proj_units2 ==
NULL)
146 double a1 = 0, a2 = 0;
153 if (a1 && a2 && (fabs(a2 - a1) > 0.000001))
163 double a1 = 0, a2 = 0;
170 if (a1 && a2 && (fabs(a2 - a1) > 0.000001))
177 if (!strcmp(proj1,
"utm") && !strcmp(proj2,
"utm")
185 if (!strcmp(proj1,
"utm") && !strcmp(proj2,
"utm")
195 const char *x_0_1 =
NULL, *x_0_2 =
NULL;
200 if (x_0_1 && x_0_2 && (fabs(atof(x_0_1) - atof(x_0_2)) > 0.000001))
209 const char *y_0_1 =
NULL, *y_0_2 =
NULL;
214 if (y_0_1 && y_0_2 && (fabs(atof(y_0_1) - atof(y_0_2)) > 0.000001))
const char * G_find_key_value(const char *key, const struct Key_Value *kv)
Find given key (case sensitive)
int G_mkdir(const char *path)
Creates a new directory.
int G_compare_projections(const struct Key_Value *proj_info1, const struct Key_Value *proj_units1, const struct Key_Value *proj_info2, const struct Key_Value *proj_units2)
Compare projections including units.
void G_write_key_value_file(const char *file, const struct Key_Value *kv)
Write key/value pairs to file.
char * G_file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
void G_setenv_nogisrc(const char *name, const char *value)
Set environment name to value (doesn't update .gisrc)
int G_put_element_window(const struct Cell_head *window, const char *dir, const char *name)
Write the region.
const char * G_gisdbase(void)
Get name of top level database directory.
int G_legal_filename(const char *s)
Check for legal database file name.
int G_make_location(const char *location_name, struct Cell_head *wind, const struct Key_Value *proj_info, const struct Key_Value *proj_units)
Create a new location.