[GRASS-dev] [grass-code R][392] raster metadata: units and veritcal datum -> cell_misc/

code R item #392, was opened at 2007-05-04 18:41
Status: Open
Priority: 3
Submitted By: Hamish Bowman (hamish)
Assigned to: Nobody (None)
Summary: raster metadata: units and veritcal datum -> cell_misc/
Issue status: None
GRASS component: raster
Operating system: None
Operating system version:

Initial Comment:
Hi,

as discussed on the mailing list*, it would be nice to add both units and vertical datum metadata.

proposal:

add raster map specific cell_misc/units and cell_misc/vertical_datum
files.

Each would hold a single line string containing the info.
You could set the value with e.g. "r.support units=".
You could query with e.g. "r.info -u".
Likewise: "r.support vdatum=", "r.info -d".

read/write using new cell_misc libgis fns described by Glynn**. [copied below]

both would be fully optional, and non-existing by default, so fully backwards
compatible with old maps.

for use by modules, just start with strcmp(tolower(*string), "meters")
for hinting. units can be anything, so I prefer to allow freeform
metadata there, not just something from a list. I fear that vertical
datums may use very local names so while a common table would be helpful
we need to allow a custom entries. I'm not too sure about them though.

[**] Glynn wrote:
-----
Given that cell_misc exists and can't easily be removed right now, you
may as well use it for now.

Just use the _misc functions which I recently added, i.e.

  char *G__file_name_misc(char *, const char *, const char *, const char *, const char *);
  char *G_find_file_misc(const char *, const char *, char *, const char *);
  char *G_find_file2_misc(const char *, const char *, const char *, const char *);
  int G__make_mapset_element_misc (const char *, const char *);
  int G_open_new_misc(const char *, const char *, const char *);
  int G_open_old_misc(const char *, const char *, const char *, const char *);
  int G_open_update_misc(const char *, const char *, const char *);
  FILE *G_fopen_new_misc(const char *, const char *, const char *);
  FILE *G_fopen_old_misc(const char *, const char *, const char *, const char *);
  FILE *G_fopen_append_misc(const char *, const char *, const char *);
  FILE *G_fopen_modify_misc(const char *, const char *, const char *);
  int G_remove_misc (const char *, const char *, const char *);

rather than using sprintf(element, "cell_misc/%s", name) hacks.
-----

examples:
  raster/r.null/null.c
  raster/r.support/front/front.c
  lib/gis/open_misc.c

and in lib/gis/:
closecell.c
file_name.c
find_file.c
get_row.c
histogram.c
mapset_msc.c
opencell.c
quant_io.c
quant_rw.c
range.c
reclass.c
remove.c
timestamp.c
user_config.c

[*] previous mailing list discussions:
  http://thread.gmane.org/gmane.comp.gis.grass.devel/19648/focus=19824
  http://thread.gmane.org/gmane.comp.gis.grass.devel/14704/focus=14789
  http://thread.gmane.org/gmane.comp.gis.grass.devel/13281/focus=13494
  http://thread.gmane.org/gmane.comp.gis.grass.devel/3840/focus=4240

Hamish

----------------------------------------------------------------------

You can respond by visiting:
http://wald.intevation.org/tracker/?func=detail&atid=188&aid=392&group_id=21