GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
Raster library - Functions to read and write raster "units", "semantic label" and "vertical datum" meta-data info. More...
#include <stdio.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/glocale.h>
Go to the source code of this file.
Functions | |
char * | Rast_read_units (const char *name, const char *mapset) |
Get a raster map's units metadata string. More... | |
void | Rast_write_units (const char *name, const char *str) |
Write a string to a raster map's units metadata file. More... | |
char * | Rast_read_vdatum (const char *name, const char *mapset) |
Get a raster map's vertical datum metadata string. More... | |
void | Rast_write_vdatum (const char *name, const char *str) |
Write a string into a raster's vertical datum metadata file. More... | |
char * | Rast_read_semantic_label (const char *name, const char *mapset) |
Get a raster map semantic label metadata string. More... | |
char * | Rast_get_semantic_label_or_name (const char *name, const char *mapset) |
Get a raster map semantic label or fall back to its name. More... | |
void | Rast_write_semantic_label (const char *name, const char *str) |
Write a string into a rasters semantic label metadata file. More... | |
bool | Rast_legal_semantic_label (const char *semantic_label) |
Check for legal semantic label. More... | |
Raster library - Functions to read and write raster "units", "semantic label" and "vertical datum" meta-data info.
(C) 2007-2009, 2021 by Hamish Bowman, Maris Nartiss, and the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file raster_metadata.c.
char* Rast_get_semantic_label_or_name | ( | const char * | name, |
const char * | mapset | ||
) |
Get a raster map semantic label or fall back to its name.
Use this function if a semantic label is needed but not mandated.
name | raster map name |
mapset | mapset name |
Definition at line 110 of file raster_metadata.c.
References G_store(), name, and Rast_read_semantic_label().
Referenced by I_iclass_init_signatures(), I_sort_signatures_by_semantic_label(), and I_SortSigSetBySemanticLabel().
bool Rast_legal_semantic_label | ( | const char * | semantic_label | ) |
Check for legal semantic label.
Legal semantic label must be a legal GRASS file name. Semantic labels are capped in length to GNAME_MAX.
This function will return false if provided semantic label is not considered to be valid. This function does not check if semantic label maps to any entry in metadata files of semantic labels as not all semantic labels have files with extra metadata.
The function prints a warning on error.
semantic | label reference to check |
Definition at line 153 of file raster_metadata.c.
char* Rast_read_semantic_label | ( | const char * | name, |
const char * | mapset | ||
) |
Get a raster map semantic label metadata string.
Read raster semantic label metadata file and put string in to str
name | raster map name |
mapset | mapset name |
Definition at line 95 of file raster_metadata.c.
Referenced by Rast_get_semantic_label_or_name().
char* Rast_read_units | ( | const char * | name, |
const char * | mapset | ||
) |
Get a raster map's units metadata string.
Read the raster's units metadata file and put string in str
name | raster map name |
mapset | mapset name |
Definition at line 37 of file raster_metadata.c.
char* Rast_read_vdatum | ( | const char * | name, |
const char * | mapset | ||
) |
Get a raster map's vertical datum metadata string.
Read the raster's vertical datum metadata file and put string in str
name | raster map name |
mapset | mapset name |
Definition at line 66 of file raster_metadata.c.
void Rast_write_semantic_label | ( | const char * | name, |
const char * | str | ||
) |
Write a string into a rasters semantic label metadata file.
Raster map must exist in the current mapset.
It is up to the caller to validate semantic label string in advance with Rast_legal_semantic_label().
name | raster map name |
str | string containing data to be written |
Definition at line 129 of file raster_metadata.c.
void Rast_write_units | ( | const char * | name, |
const char * | str | ||
) |
Write a string to a raster map's units metadata file.
Raster map must exist in the current mapset.
name | raster map name |
str | string containing data to be written |
Definition at line 50 of file raster_metadata.c.
void Rast_write_vdatum | ( | const char * | name, |
const char * | str | ||
) |
Write a string into a raster's vertical datum metadata file.
Raster map must exist in the current mapset.
name | raster map name |
str | string containing data to be written |
Definition at line 79 of file raster_metadata.c.