69 sprintf(
path,
"%s/%s/%s",
G_gisdbase(), location_name,
"PERMANENT");
83 if (proj_info !=
NULL) {
88 if (proj_units !=
NULL) {
139 if (proj_epsg !=
NULL) {
188 const char *proj_srid,
const char *proj_wkt)
198 if (proj_srid !=
NULL) {
203 if (proj_wkt !=
NULL) {
236 const char *proj1, *proj2;
238 if (proj_info1 ==
NULL && proj_info2 ==
NULL)
245 if (proj_info1 ==
NULL || proj_info2 ==
NULL)
251 if (proj1 ==
NULL || proj2 ==
NULL || strcmp(proj1, proj2))
258 if (proj_units1 ==
NULL && proj_units2 ==
NULL)
261 if (proj_units1 ==
NULL || proj_units2 ==
NULL)
265 double a1 = 0, a2 = 0;
272 if (a1 && a2 && (fabs(a2 - a1) > 0.000001))
278 const char *u_1 =
NULL, *u_2 =
NULL;
283 if ((u_1 && !u_2) || (!u_1 && u_2))
300 const char *d_1 =
NULL, *d_2 =
NULL;
305 if ((d_1 && !d_2) || (!d_1 && d_2))
308 if (d_1 && d_2 && strcmp(d_1, d_2)) {
311 G_debug(1,
"Different datum names");
319 const char *e_1 =
NULL, *e_2 =
NULL;
324 if (e_1 && e_2 && strcmp(e_1, e_2))
328 double a1 = 0, a2 = 0;
329 double es1 = 0, es2 = 0;
352 if ((a1 == 0 && a2 != 0) || (a1 != 0 && a2 == 0))
355 if (a1 && a2 && (fabs(a2 - a1) > 0.000001))
358 if ((es1 == 0 && es2 != 0) || (es1 != 0 && es2 == 0))
361 if (es1 && es2 && (fabs(es2 - es1) > 0.000001))
369 if (!strcmp(proj1,
"utm") && !strcmp(proj2,
"utm") &&
377 if (!strcmp(proj1,
"utm") && !strcmp(proj2,
"utm") &&
387 const char *x_0_1 =
NULL, *x_0_2 =
NULL;
392 if ((x_0_1 && !x_0_2) || (!x_0_1 && x_0_2))
395 if (x_0_1 && x_0_2 && (fabs(atof(x_0_1) - atof(x_0_2)) > 0.000001))
404 const char *y_0_1 =
NULL, *y_0_2 =
NULL;
409 if ((y_0_1 && !y_0_2) || (!y_0_1 && y_0_2))
412 if (y_0_1 && y_0_2 && (fabs(atof(y_0_1) - atof(y_0_2)) > 0.000001))
421 const char *l_1 =
NULL, *l_2 =
NULL;
426 if ((l_1 && !l_2) || (!l_1 && l_2))
429 if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001))
441 if ((l_1 && !l_2) || (!l_1 && l_2))
444 if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001))
456 if ((l_1 && !l_2) || (!l_1 && l_2))
459 if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001)) {
466 if (fabs(atof(l_1) - atof(l_2)) > 0.000001) {
474 if ((l_1 && !l_2) || (!l_1 && l_2))
477 if (l_1 && l_2 && (fabs(atof(l_1) - atof(l_2)) > 0.000001)) {
484 if (fabs(atof(l_1) - atof(l_2)) > 0.000001) {
520 if (location_name && *location_name)
521 sprintf(
path,
"%s/%s/%s/%s",
G_gisdbase(), location_name,
"PERMANENT",
526 fp = fopen(
path,
"w");
533 n = strlen(wktstring);
534 if (wktstring[n - 1] !=
'\n') {
535 if (n != fprintf(fp,
"%s\n", wktstring))
539 if (n != fprintf(fp,
"%s", wktstring))
572 if (location_name && *location_name)
573 sprintf(
path,
"%s/%s/%s/%s",
G_gisdbase(), location_name,
"PERMANENT",
578 fp = fopen(
path,
"w");
585 n = strlen(sridstring);
586 if (sridstring[n - 1] !=
'\n') {
587 if (n != fprintf(fp,
"%s\n", sridstring))
591 if (n != fprintf(fp,
"%s", sridstring))
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
const char * G_gisdbase(void)
Get name of top level database directory.
int G_legal_filename(const char *)
Check for legal database file name.
const char * G_find_key_value(const char *, const struct Key_Value *)
Find given key (case sensitive)
int G_get_ellipsoid_by_name(const char *, double *, double *)
Get ellipsoid parameters by name.
void G_write_key_value_file(const char *, const struct Key_Value *)
Write key/value pairs to file.
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
int G_put_element_window(const struct Cell_head *, const char *, const char *)
Write the region.
int G_mkdir(const char *)
Creates a new directory.
int G_debug(int, const char *,...) __attribute__((format(printf
void G_setenv_nogisrc(const char *, const char *)
Set environment name to value (doesn't update .gisrc)
int G_make_location_crs(const char *location_name, struct Cell_head *wind, const struct Key_Value *proj_info, const struct Key_Value *proj_units, const char *proj_srid, const char *proj_wkt)
Create a new location.
int G_write_projsrid(const char *location_name, const char *sridstring)
Write srid (spatial reference id) to file.
int G_write_projwkt(const char *location_name, const char *wktstring)
Write WKT definition to file.
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.
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.
int G_make_location_epsg(const char *location_name, struct Cell_head *wind, const struct Key_Value *proj_info, const struct Key_Value *proj_units, const struct Key_Value *proj_epsg)
Create a new location.
2D/3D raster map header (used also for region)
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)