16 #include <grass/gis.h> 17 #include <grass/glocale.h> 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));
228 char *sridstring =
NULL;
235 if (access(path, 0) != 0) {
238 const char *epsg_num;
240 G_debug(1,
"<%s> file not found for location <%s>",
247 G_debug(1,
"Using <%s> file instead for location <%s>",
259 fp = fopen(path,
"r");
261 G_fatal_error(
_(
"Unable to open input file <%s>: %s"), path, strerror(errno));
263 sridstring = G_malloc(1024 *
sizeof(
char));
289 sridstring = G_realloc(sridstring, nalloc + 1024);
300 sridstring = G_realloc(sridstring, nalloc + 1);
303 sridstring[n] =
'\0';
311 G_fatal_error(
_(
"Error closing output file <%s>: %s"), path, strerror(errno));
313 return G_chop(sridstring);
const char * G_location(void)
Get current location name.
const char * G_find_key_value(const char *key, const struct Key_Value *kv)
Find given key (case sensitive)
void G_free(void *buf)
Free allocated memory.
struct Key_Value * G_get_projunits(void)
Gets units information for location.
int G_asprintf(char **out, const char *fmt,...)
#define PROJECTION_XY
Projection code - XY coordinate system (unreferenced data)
char * G_chop(char *line)
Chop leading and trailing white spaces.
void G_free_key_value(struct Key_Value *kv)
Free allocated Key_Value structure.
void G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
struct Key_Value * G_read_key_value_file(const char *file)
Read key/values pairs from file.
char * G_file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
int G_debug(int level, const char *msg,...)
Print debugging message.
char * G_get_projwkt(void)
Get WKT information for the current location.
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.
struct Key_Value * G_get_projepsg(void)
Gets EPSG information for the current location.
void G_set_key_value(const char *key, const char *value, struct Key_Value *kv)
Set value for given key.
int G_projection(void)
Query cartographic projection.
void G_warning(const char *msg,...)
Print a warning message to stderr.