3 #include <grass/glocale.h>
5 static int lookup(
const char *,
const char *,
char *,
int);
6 static int equal(
const char *,
const char *);
7 static int lower(
char);
24 static char name[256];
34 if (!lookup(UNIT_FILE, plural ?
"units" :
"unit", name,
sizeof(name)))
35 strcpy(name, plural ?
"units" :
"unit");
54 static char name[256];
63 if (!lookup(PROJECTION_FILE,
"name", name,
sizeof(name)))
64 strcpy(name, _(
"Unknown projection"));
100 if (lookup(UNIT_FILE,
"meters", buf,
sizeof(buf)))
101 sscanf(buf,
"%lf", &factor);
104 for (n = 0; table[
n].unit; n++)
105 if (equal(unit, table[n].unit)) {
106 factor = table[
n].factor;
135 static char name[256], params[256];
136 struct Key_Value *projinfo;
139 if (lookup(PROJECTION_FILE,
"datum", name,
sizeof(name)))
147 if (datumstatus == 2)
164 static char name[256];
166 if (!lookup(PROJECTION_FILE,
"ellps", name,
sizeof(name))) {
170 sprintf(name,
"a=%.16g es=%.16g", a, es);
177 static int lookup(
const char *
file,
const char *key,
char *
value,
int len)
179 char path[GPATH_MAX];
190 static int equal(
const char *a,
const char *
b)
195 if (lower(*a++) != lower(*b++))
202 static int lower(
char c)
204 if (c >=
'A' && c <=
'Z')
char * G__unit_name(int unit, int plural)
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
int G_get_datumparams_from_projinfo(const struct Key_Value *projinfo, char *datumname, char *params)
int G_free_key_value(struct Key_Value *kv)
Free allocated Key_Value structure.
int G_get_ellipsoid_parameters(double *a, double *e2)
get ellipsoid parameters
char * G_database_unit_name(int plural)
database units
int G_lookup_key_value_from_file(const char *file, const char *key, char value[], int n)
Look up for key in file.
int G__projection_units(int n)
char * G__file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
struct Key_Value * G_get_projinfo(void)
Gets projection information for location.
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
char * G_database_ellipse_name(void)
char * G__projection_name(int n)
char * G_database_datum_name(void)
get datum name for database
double G_database_units_to_meters_factor(void)
conversion to meters
int G_projection(void)
query cartographic projection
char * G_database_projection_name(void)
query cartographic projection