19 #define PERMANENT "PERMANENT" 38 if (access(path, 0) != 0) {
40 G_warning(
_(
"<%s> file not found for location <%s>"),
63 struct Key_Value *in_proj_keys, *in_epsg_keys;
67 if (access(path, 0) != 0) {
69 G_warning(
_(
"<%s> file not found for location <%s>"),
81 sprintf(buf,
"EPSG:%s", epsgstr);
108 if (access(path, 0) != 0) {
110 G_debug(1,
"<%s> file not found for location <%s>",
129 char *wktstring =
NULL;
136 if (access(path, 0) != 0) {
138 G_debug(1,
"<%s> file not found for location <%s>",
144 fp = fopen(path,
"r");
146 G_fatal_error(
_(
"Unable to open input file <%s>: %s"), path, strerror(errno));
148 wktstring =
G_malloc(1024 *
sizeof(
char));
174 wktstring =
G_realloc(wktstring, nalloc + 1024);
185 wktstring =
G_realloc(wktstring, nalloc + 1);
196 G_fatal_error(
_(
"Error closing output file <%s>: %s"), path, strerror(errno));
198 if (wktstring && *wktstring)
200 if (wktstring && *wktstring ==
'\0') {
235 char *sridstring =
NULL;
242 if (access(path, 0) != 0) {
245 const char *epsg_num;
247 G_debug(1,
"<%s> file not found for location <%s>",
254 G_debug(1,
"Using <%s> file instead for location <%s>",
266 fp = fopen(path,
"r");
268 G_fatal_error(
_(
"Unable to open input file <%s>: %s"), path, strerror(errno));
270 sridstring =
G_malloc(1024 *
sizeof(
char));
296 sridstring =
G_realloc(sridstring, nalloc + 1024);
307 sridstring =
G_realloc(sridstring, nalloc + 1);
310 sridstring[n] =
'\0';
318 G_fatal_error(
_(
"Error closing output file <%s>: %s"), path, strerror(errno));
320 if (sridstring && *sridstring)
322 if (sridstring && *sridstring ==
'\0') {
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
struct Key_Value * G_read_key_value_file(const char *)
Read key/values pairs from file.
struct Key_Value * G_get_projunits(void)
Gets units information for location.
int G_projection(void)
Query cartographic projection.
void G_free(void *)
Free allocated memory.
#define PROJECTION_XY
Projection code - XY coordinate system (unreferenced data)
const char * G_location(void)
Get current location name.
char * G_get_projwkt(void)
Get WKT information for the current location.
void G_set_key_value(const char *, const char *, struct Key_Value *)
Set value for given key.
char * G_get_projsrid(void)
Get srid (spatial reference id) for the current location.
struct Key_Value * G_get_projinfo(void)
Gets projection information for location.
char * G_chop(char *)
Chop leading and trailing white spaces.
struct Key_Value * G_get_projepsg(void)
Gets EPSG information for the current location.
void G_warning(const char *,...) __attribute__((format(printf
int G_asprintf(char **, const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
void G_free_key_value(struct Key_Value *)
Free allocated Key_Value structure.
const char * G_find_key_value(const char *, const struct Key_Value *)
Find given key (case sensitive)