GRASS GIS 7 Programmer's Manual  7.9.dev(2021)-8f4931381
raster/band_reference.c File Reference

Raster Library - Band reference managenent. More...

#include <string.h>
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/glocale.h>
Include dependency graph for raster/band_reference.c:

Go to the source code of this file.

Functions

int Rast_has_band_reference (const char *name, const char *mapset)
 Check if band reference for raster map exists. More...
 
int Rast_read_band_reference (const char *name, const char *mapset, char **filename, char **band_reference)
 Read raster map band reference identifier. More...
 
int Rast_write_band_reference (const char *name, const char *filename, const char *band_reference)
 Write raster map band reference identifier. More...
 
int Rast_remove_band_reference (const char *name)
 Remove band reference from raster map. More...
 

Detailed Description

Raster Library - Band reference managenent.

(C) 2019 by 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.

Author
Martin Landa (with financial support by mundialis, Bonn, for openEO EU H2020 grant 776242, https://openeo.org)

Definition in file raster/band_reference.c.

Function Documentation

◆ Rast_has_band_reference()

int Rast_has_band_reference ( const char *  name,
const char *  mapset 
)

Check if band reference for raster map exists.

Parameters
namemap name
mapsetmapset name
Returns
1 on success
0 no band reference present

Definition at line 32 of file raster/band_reference.c.

References G_find_file2_misc().

◆ Rast_read_band_reference()

int Rast_read_band_reference ( const char *  name,
const char *  mapset,
char **  filename,
char **  band_reference 
)

Read raster map band reference identifier.

Note that output arguments should be freed by the caller using G_free().

Parameters
namemap name
mapsetmapset name
[out]filenamefilename JSON reference
[out]band_referenceband reference identifier
Returns
1 on success
0 band reference not found
negative on error

Definition at line 54 of file raster/band_reference.c.

◆ Rast_remove_band_reference()

int Rast_remove_band_reference ( const char *  name)

Remove band reference from raster map.

Only band reference files in current mapset can be removed.

Parameters
namemap name
Returns
0 if no file
1 on success
-1 on error

Definition at line 123 of file raster/band_reference.c.

References G_remove_misc().

◆ Rast_write_band_reference()

int Rast_write_band_reference ( const char *  name,
const char *  filename,
const char *  band_reference 
)

Write raster map band reference identifier.

Parameters
namemap name
filenamefilename JSON reference
band_referenceband reference identifier
Returns
1 on success
negative on error

Definition at line 94 of file raster/band_reference.c.