GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
get_projinfo.c
Go to the documentation of this file.
1 
14 #include <unistd.h>
15 #include <grass/gis.h>
16 #include <grass/glocale.h>
17 
18 #define PERMANENT "PERMANENT"
19 
25 struct Key_Value *G_get_projunits(void)
26 {
27  int stat;
28  struct Key_Value *in_units_keys;
29  char path[GPATH_MAX];
30 
31  G__file_name(path, "", UNIT_FILE, PERMANENT);
32  if (access(path, 0) != 0) {
33  G_warning(_("<%s> file not found for location <%s>"),
34  UNIT_FILE, G_location());
35  return NULL;
36  }
37  in_units_keys = G_read_key_value_file(path, &stat);
38  if (stat != 0) {
39  G_warning(_("ERROR in reading <%s> file for location <%s>"),
40  UNIT_FILE, G_location());
41  return NULL;
42  }
43 
44  return in_units_keys;
45 }
46 
52 struct Key_Value *G_get_projinfo(void)
53 {
54  int stat;
55  struct Key_Value *in_proj_keys;
56  char path[GPATH_MAX];
57 
58  G__file_name(path, "", PROJECTION_FILE, PERMANENT);
59  if (access(path, 0) != 0) {
60  G_warning(_("<%s> file not found for location <%s>"),
61  PROJECTION_FILE, G_location());
62  return NULL;
63  }
64  in_proj_keys = G_read_key_value_file(path, &stat);
65  if (stat != 0) {
66  G_warning(_("ERROR in reading <%s> file for location <%s>"),
67  PROJECTION_FILE, G_location());
68  return NULL;
69  }
70  return in_proj_keys;
71 }
#define PERMANENT
Definition: get_projinfo.c:18
struct Key_Value * G_get_projunits(void)
Gets unit information for location.
Definition: get_projinfo.c:25
int stat
Definition: g3dcolor.c:369
char * G__file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
Definition: file_name.c:33
struct Key_Value * G_read_key_value_file(const char *file, int *stat)
Read key/values pairs from file.
Definition: key_value3.c:54
char * G_location(void)
Get current location name.
Definition: location.c:61
struct Key_Value * G_get_projinfo(void)
Gets projection information for location.
Definition: get_projinfo.c:52
return NULL
Definition: dbfopen.c:1394
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)