GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
raster3d/header.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <sys/types.h>
4 #include <unistd.h>
5 #include <grass/raster3d.h>
6 #include <grass/glocale.h>
7 #include "raster3d_intern.h"
8 
9 /*---------------------------------------------------------------------------*/
10 
13 void *xdr;
15 
16 /*---------------------------------------------------------------------------*/
17 
18 #define RASTER3D_HEADER_TILEX "TileDimensionX"
19 #define RASTER3D_HEADER_TILEY "TileDimensionY"
20 #define RASTER3D_HEADER_TILEZ "TileDimensionZ"
21 #define RASTER3D_HEADER_TYPE "CellType"
22 #define RASTER3D_HEADER_COMPRESSION "useCompression"
23 #define RASTER3D_HEADER_USERLE "useRle"
24 #define RASTER3D_HEADER_USELZW "useLzw"
25 #define RASTER3D_HEADER_PRECISION "Precision"
26 #define RASTER3D_HEADER_DATA_OFFSET "nofHeaderBytes"
27 #define RASTER3D_HEADER_USEXDR "useXdr"
28 #define RASTER3D_HEADER_HASINDEX "hasIndex"
29 #define RASTER3D_HEADER_UNIT "Units"
30 #define RASTER3D_HEADER_VERTICAL_UNIT "VerticalUnits"
31 #define RASTER3D_HEADER_VERSION "Version"
32 
33 /*---------------------------------------------------------------------------*/
34 
35 static int
36 Rast3d_readWriteHeader(struct Key_Value *headerKeys, int doRead, int *proj,
37  int *zone, double *north, double *south, double *east,
38  double *west, double *top, double *bottom, int *rows,
39  int *cols, int *depths, double *ew_res, double *ns_res,
40  double *tb_res, int *tileX, int *tileY, int *tileZ,
41  int *type, int *compression, int *useRle, int *useLzw,
42  int *precision, int *dataOffset, int *useXdr,
43  int *hasIndex, char **unit, int *vertical_unit, int *version)
44 {
45  int returnVal;
46  int (*headerInt) (), (*headerDouble) (), (*headerValue) ();
47  int (*headerString) ();
48 
49  if (doRead) {
50  headerDouble = Rast3d_key_get_double;
51  headerInt = Rast3d_key_get_int;
52  headerString = Rast3d_key_get_string;
53  headerValue = Rast3d_key_get_value;
54  }
55  else {
56  headerDouble = Rast3d_key_set_double;
57  headerInt = Rast3d_key_set_int;
58  headerString = Rast3d_key_set_string;
59  headerValue = Rast3d_key_set_value;
60  }
61 
62  returnVal = 1;
63  returnVal &= headerInt(headerKeys, RASTER3D_REGION_PROJ, proj);
64  returnVal &= headerInt(headerKeys, RASTER3D_REGION_ZONE, zone);
65 
66  returnVal &= headerDouble(headerKeys, RASTER3D_REGION_NORTH, north);
67  returnVal &= headerDouble(headerKeys, RASTER3D_REGION_SOUTH, south);
68  returnVal &= headerDouble(headerKeys, RASTER3D_REGION_EAST, east);
69  returnVal &= headerDouble(headerKeys, RASTER3D_REGION_WEST, west);
70  returnVal &= headerDouble(headerKeys, RASTER3D_REGION_TOP, top);
71  returnVal &= headerDouble(headerKeys, RASTER3D_REGION_BOTTOM, bottom);
72 
73  returnVal &= headerInt(headerKeys, RASTER3D_REGION_ROWS, rows);
74  returnVal &= headerInt(headerKeys, RASTER3D_REGION_COLS, cols);
75  returnVal &= headerInt(headerKeys, RASTER3D_REGION_DEPTHS, depths);
76 
77  returnVal &= headerDouble(headerKeys, RASTER3D_REGION_NSRES, ns_res);
78  returnVal &= headerDouble(headerKeys, RASTER3D_REGION_EWRES, ew_res);
79  returnVal &= headerDouble(headerKeys, RASTER3D_REGION_TBRES, tb_res);
80 
81  returnVal &= headerInt(headerKeys, RASTER3D_HEADER_TILEX, tileX);
82  returnVal &= headerInt(headerKeys, RASTER3D_HEADER_TILEY, tileY);
83  returnVal &= headerInt(headerKeys, RASTER3D_HEADER_TILEZ, tileZ);
84 
85  returnVal &= headerValue(headerKeys, RASTER3D_HEADER_TYPE,
86  "double", "float", DCELL_TYPE, FCELL_TYPE, type);
87  returnVal &= headerValue(headerKeys, RASTER3D_HEADER_COMPRESSION,
88  "0", "1", 0, 1, compression);
89  returnVal &= headerValue(headerKeys, RASTER3D_HEADER_USERLE,
90  "0", "1", 0, 1, useRle);
91  returnVal &= headerValue(headerKeys, RASTER3D_HEADER_USELZW,
92  "0", "1", 0, 1, useLzw);
93 
94  returnVal &= headerInt(headerKeys, RASTER3D_HEADER_PRECISION, precision);
95  returnVal &= headerInt(headerKeys, RASTER3D_HEADER_DATA_OFFSET, dataOffset);
96 
97  returnVal &= headerValue(headerKeys, RASTER3D_HEADER_USEXDR,
98  "0", "1", 0, 1, useXdr);
99  returnVal &= headerValue(headerKeys, RASTER3D_HEADER_HASINDEX,
100  "0", "1", 0, 1, hasIndex);
101  returnVal &= headerString(headerKeys, RASTER3D_HEADER_UNIT, unit);
102  /* New format and API changes */
103  if(!headerInt(headerKeys, RASTER3D_HEADER_VERTICAL_UNIT, vertical_unit))
104  G_warning("You are using an old raster3d data format, the vertical unit is undefined. "
105  "Please use r3.support to define the vertical unit to avoid this warning.");
106  /* New format and API changes */
107  if(!headerInt(headerKeys, RASTER3D_HEADER_VERSION, version)) {
108  G_warning("You are using an old raster3d data format, the version is undefined.");
109  *version = 1;
110  }
111 
112  if (returnVal)
113  return 1;
114 
115  Rast3d_error("Rast3d_readWriteHeader: error reading/writing header");
116  return 0;
117 }
118 
119 /*---------------------------------------------------------------------------*/
120 
121 int
122 Rast3d_read_header(RASTER3D_Map * map, int *proj, int *zone, double *north,
123  double *south, double *east, double *west, double *top,
124  double *bottom, int *rows, int *cols, int *depths,
125  double *ew_res, double *ns_res, double *tb_res, int *tileX,
126  int *tileY, int *tileZ, int *type, int *compression,
127  int *useRle, int *useLzw, int *precision, int *dataOffset,
128  int *useXdr, int *hasIndex, char **unit, int *vertical_unit,
129  int *version)
130 {
131  struct Key_Value *headerKeys;
132  char path[GPATH_MAX];
133 
135  if (access(path, R_OK) != 0) {
136  Rast3d_error("Rast3d_read_header: unable to find [%s]", path);
137  return 0;
138  }
139 
140  headerKeys = G_read_key_value_file(path);
141 
142  if (!Rast3d_readWriteHeader(headerKeys, 1,
143  proj, zone,
144  north, south, east, west, top, bottom,
145  rows, cols, depths,
146  ew_res, ns_res, tb_res,
147  tileX, tileY, tileZ,
148  type, compression, useRle, useLzw, precision,
149  dataOffset, useXdr, hasIndex, unit, vertical_unit, version)) {
150  Rast3d_error("Rast3d_read_header: error extracting header key(s) of file %s",
151  path);
152  return 0;
153  }
154 
155  G_free_key_value(headerKeys);
156  return 1;
157 }
158 
159 /*---------------------------------------------------------------------------*/
160 
161 int
162 Rast3d_write_header(RASTER3D_Map * map, int proj, int zone, double north, double south,
163  double east, double west, double top, double bottom, int rows,
164  int cols, int depths, double ew_res, double ns_res,
165  double tb_res, int tileX, int tileY, int tileZ, int type,
166  int compression, int useRle, int useLzw, int precision,
167  int dataOffset, int useXdr, int hasIndex, char *unit, int vertical_unit,
168  int version)
169 {
170  struct Key_Value *headerKeys;
171  char path[GPATH_MAX];
172 
173  headerKeys = G_create_key_value();
174 
175  if (!Rast3d_readWriteHeader(headerKeys, 0,
176  &proj, &zone,
177  &north, &south, &east, &west, &top, &bottom,
178  &rows, &cols, &depths,
179  &ew_res, &ns_res, &tb_res,
180  &tileX, &tileY, &tileZ,
181  &type, &compression, &useRle, &useLzw,
182  &precision, &dataOffset, &useXdr, &hasIndex,
183  &unit, &vertical_unit, &version)) {
184  Rast3d_error("Rast3d_write_header: error adding header key(s) for file %s",
185  path);
186  return 0;
187  }
188 
191  G_write_key_value_file(path, headerKeys);
192 
193  G_free_key_value(headerKeys);
194 
195  return 1;
196 }
197 /*---------------------------------------------------------------------------*/
198 
199 int
201 {
202  if (!Rast3d_write_header(map,
203  map->region.proj, map->region.zone,
204  map->region.north, map->region.south,
205  map->region.east, map->region.west,
206  map->region.top, map->region.bottom,
207  map->region.rows, map->region.cols,
208  map->region.depths,
209  map->region.ew_res, map->region.ns_res,
210  map->region.tb_res,
211  map->tileX, map->tileY, map->tileZ,
212  map->type,
213  map->compression, map->useRle, map->useLzw,
214  map->precision, map->offset, map->useXdr,
215  map->hasIndex, map->unit, map->vertical_unit,
216  map->version)) {
217  G_warning(_("Unable to write header for 3D raster map <%s>"), map->fileName);
218  return 0;
219  }
220  return 1;
221 }
222 
223 /*---------------------------------------------------------------------------*/
224 
225 
226 /*!
227  * \brief
228  *
229  * Returns a number
230  * which encodes multiplicity <em>n</em> of <em>cacheCode</em>. This value can be used
231  * to specify the size of the cache.
232  * If <em>cacheCode</em> is the size (in tiles) of the cache the function returns
233  * <em>cacheCode * n</em>.
234  * If <em>cacheCode</em> is RASTER3D_USE_CACHE_DEFAULT the function returns
235  * RASTER3D_USE_CACHE_DEFAULT.
236  * If <em>cacheCode</em> is RASTER3D_USE_CACHE_??? the function returns a value
237  * encoding RASTER3D_USE_CACHE_??? and <em>n</em>. Here RASTER3D_USE_CACHE_??? is one
238  * of RASTER3D_USE_CACHE_X, RASTER3D_USE_CACHE_Y, RASTER3D_USE_CACHE_Z,
239  * RASTER3D_USE_CACHE_XY, RASTER3D_USE_CACHE_XZ, RASTER3D_USE_CACHE_YZ, or
240  * RASTER3D_USE_CACHE_XYZ, where e.g. RASTER3D_USE_CACHE_X specifies that the cache
241  * should store as many tiles as there exist in one row along the x-axis of the
242  * tile cube, and RASTER3D_USE_CACHE_XY specifies that the cache should store as
243  * many tiles as there exist in one slice of the tile cube with constant Z
244  * coordinate.
245  *
246  * \param cacheCode
247  * \param n
248  * \return int
249  */
250 
251 int Rast3d_cache_size_encode(int cacheCode, int n)
252 {
253  if (cacheCode >= RASTER3D_NO_CACHE)
254  return cacheCode * n;
255  if (cacheCode == RASTER3D_USE_CACHE_DEFAULT)
256  return cacheCode;
257 
258  if (cacheCode < RASTER3D_USE_CACHE_XYZ)
259  Rast3d_fatal_error("Rast3d_cache_size_encode: invalid cache code");
260 
261  return n * (-10) + cacheCode;
262 }
263 
264 /*---------------------------------------------------------------------------*/
265 
266 int Rast3d__compute_cache_size(RASTER3D_Map * map, int cacheCode)
267 {
268  int n, size;
269 
270  if (cacheCode >= RASTER3D_NO_CACHE)
271  return cacheCode;
272  if (cacheCode == RASTER3D_USE_CACHE_DEFAULT)
273  return RASTER3D_MIN(g3d_cache_default, map->nTiles);
274 
275  n = -(cacheCode / 10);
276  n = RASTER3D_MAX(1, n);
277  cacheCode = -((-cacheCode) % 10);
278 
279  if (cacheCode == RASTER3D_USE_CACHE_X)
280  size = map->nx * n;
281  else if (cacheCode == RASTER3D_USE_CACHE_Y)
282  size = map->ny * n;
283  else if (cacheCode == RASTER3D_USE_CACHE_Z)
284  size = map->nz * n;
285  else if (cacheCode == RASTER3D_USE_CACHE_XY)
286  size = map->nxy * n;
287  else if (cacheCode == RASTER3D_USE_CACHE_XZ)
288  size = map->nx * map->nz * n;
289  else if (cacheCode == RASTER3D_USE_CACHE_YZ)
290  size = map->ny * map->nz * n;
291  else if (cacheCode == RASTER3D_USE_CACHE_XYZ)
292  size = map->nTiles;
293  else
294  Rast3d_fatal_error("Rast3d__compute_cache_size: invalid cache code");
295 
296  return RASTER3D_MIN(size, map->nTiles);
297 }
298 
299 /*---------------------------------------------------------------------------*/
300 
301 /* this function does actually more than filling the header fields of the */
302 /* RASTER3D-Map structure. It also allocates memory for compression and xdr, */
303 /* and initializes the index and cache. This function should be taken apart. */
304 
305 int
306 Rast3d_fill_header(RASTER3D_Map * map, int operation, int compression, int useRle,
307  int useLzw, int type, int precision, int cache, int hasIndex,
308  int useXdr, int typeIntern, int nofHeaderBytes, int tileX,
309  int tileY, int tileZ, int proj, int zone, double north,
310  double south, double east, double west, double top,
311  double bottom, int rows, int cols, int depths, double ew_res,
312  double ns_res, double tb_res, char *unit, int vertical_unit,
313  int version)
314 {
315  if (!RASTER3D_VALID_OPERATION(operation))
316  Rast3d_fatal_error("Rast3d_fill_header: operation not valid\n");
317 
318  map->version = version;
319 
320  map->operation = operation;
321 
322  map->unit = G_store(unit);
323  map->vertical_unit = vertical_unit;
324 
325  map->region.proj = proj;
326  map->region.zone = zone;
327 
328  map->region.north = north;
329  map->region.south = south;
330  map->region.east = east;
331  map->region.west = west;
332  map->region.top = top;
333  map->region.bottom = bottom;
334 
335  map->region.rows = rows;
336  map->region.cols = cols;
337  map->region.depths = depths;
338 
339  map->region.ew_res = ew_res;
340  map->region.ns_res = ns_res;
341  map->region.tb_res = tb_res;
342 
343  Rast3d_adjust_region(&(map->region));
344 
345  map->tileX = tileX;
346  map->tileY = tileY;
347  map->tileZ = tileZ;
348  map->tileXY = map->tileX * map->tileY;
349  map->tileSize = map->tileXY * map->tileZ;
350 
351  map->nx = (map->region.cols - 1) / tileX + 1;
352  map->ny = (map->region.rows - 1) / tileY + 1;
353  map->nz = (map->region.depths - 1) / tileZ + 1;
354  map->nxy = map->nx * map->ny;
355  map->nTiles = map->nxy * map->nz;
356 
357  if ((map->region.cols) % map->tileX != 0)
358  map->clipX = map->nx - 1;
359  else
360  map->clipX = -1;
361  if ((map->region.rows) % map->tileY != 0)
362  map->clipY = map->ny - 1;
363  else
364  map->clipY = -1;
365  if ((map->region.depths) % map->tileZ != 0)
366  map->clipZ = map->nz - 1;
367  else
368  map->clipZ = -1;
369 
370  if ((type != FCELL_TYPE) && (type != DCELL_TYPE))
371  Rast3d_fatal_error("Rast3d_fill_header: invalid type");
372  map->type = type;
373 
374  if ((typeIntern != FCELL_TYPE) && (typeIntern != DCELL_TYPE))
375  Rast3d_fatal_error("Rast3d_fill_header: invalid type");
376  map->typeIntern = typeIntern;
377 
378  if (!RASTER3D_VALID_XDR_OPTION(useXdr))
379  Rast3d_fatal_error("Rast3d_fill_header: invalid xdr option");
380  map->useXdr = useXdr; /* Only kept for backward compatibility */
381 
382  map->offset = nofHeaderBytes;
383 
384  if ((map->fileEndPtr = lseek(map->data_fd, (long)0, SEEK_END)) == -1) {
385  Rast3d_error("Rast3d_fill_header: can't position file");
386  return 0;
387  }
388 
389  map->useCache = (cache != RASTER3D_NO_CACHE);
390 
393 
394  map->compression = compression;
395  map->useRle = useRle; /* Only kept for backward compatibility */
396  map->useLzw = useLzw; /* Only kept for backward compatibility */
397  map->precision = precision;
398 
399 #define RLE_STATUS_BYTES 2
400 
401  if (map->compression != RASTER3D_NO_COMPRESSION) {
402  if (tmpCompress == NULL) {
403  tmpCompressLength = map->tileSize *
407  if (tmpCompress == NULL) {
408  Rast3d_error("Rast3d_fill_header: error in Rast3d_malloc");
409  return 0;
410  }
411  }
412  else if (map->tileSize *
415  tmpCompressLength = map->tileSize *
419  if (tmpCompress == NULL) {
420  Rast3d_error("Rast3d_fill_header: error in Rast3d_realloc");
421  return 0;
422  }
423  }
424  }
425 
426 #define XDR_MISUSE_BYTES 10
427 
429  Rast3d_error("Rast3d_fill_header: error in Rast3d_init_fp_xdr");
430  return 0;
431  }
432 
433  if ((!map->useCache) ||
434  ((cache == RASTER3D_USE_CACHE_DEFAULT) && (g3d_cache_default == 0))) {
435  map->useCache = 0;
436  map->cache = NULL;
437  /* allocate one tile buffer */
438  map->data = Rast3d_malloc(map->tileSize * map->numLengthIntern);
439  if (map->data == NULL) {
440  Rast3d_error("Rast3d_fill_header: error in Rast3d_malloc");
441  return 0;
442  }
443  map->currentIndex = -1;
444  }
445  else {
446  if (!Rast3d_init_cache(map,
447  RASTER3D_MAX(1,
449  g3d_cache_max /
450  map->tileSize /
451  map->numLengthIntern)))) {
452  Rast3d_error("Rast3d_fill_header: error in Rast3d_init_cache");
453  return 0;
454  }
455  }
456 
457  if (!Rast3d_init_index(map, hasIndex)) {
458  Rast3d_error("Rast3d_fill_header: error in Rast3d_init_index");
459  return 0;
460  }
461 
462  return 1;
463 }
int numLengthIntern
Definition: raster3d.h:175
#define RASTER3D_USE_CACHE_DEFAULT
Definition: raster3d.h:20
double east
Definition: raster3d.h:51
if(!(yy_init))
Definition: sqlp.yy.c:775
unsigned short compression
Definition: gsd_img_tif.c:42
#define XDR_MISUSE_BYTES
#define RASTER3D_USE_CACHE_Z
Definition: raster3d.h:23
int numLengthExtern
Definition: raster3d.h:172
struct Key_Value * G_read_key_value_file(const char *)
Read key/values pairs from file.
Definition: key_value3.c:53
void * cache
Definition: raster3d.h:160
#define RASTER3D_USE_CACHE_XYZ
Definition: raster3d.h:27
double top
Definition: raster3d.h:52
int Rast3d_key_set_int(struct Key_Value *, const char *, const int *)
Definition: keys.c:91
double tb_res
Definition: raster3d.h:57
char * fileName
Definition: raster3d.h:76
#define RASTER3D_USE_CACHE_XZ
Definition: raster3d.h:25
int xdrLength
int Rast3d_key_get_string(struct Key_Value *, const char *, char **)
Definition: keys.c:47
int fileEndPtr
Definition: raster3d.h:132
double bottom
Definition: raster3d.h:52
int Rast3d_init_cache(RASTER3D_Map *, int)
Definition: cache.c:217
#define RASTER3D_VALID_OPERATION(o)
int hasIndex
Definition: raster3d.h:135
void * Rast3d_malloc(int)
Same as malloc (nBytes), except that in case of error Rast3d_error() is invoked.
int typeIntern
Definition: raster3d.h:149
#define RASTER3D_HEADER_USELZW
int operation
Definition: raster3d.h:81
#define RASTER3D_USE_CACHE_X
Definition: raster3d.h:21
#define RASTER3D_REGION_ROWS
double ns_res
Definition: raster3d.h:57
#define RASTER3D_HEADER_TILEY
int useCache
Definition: raster3d.h:159
int Rast3d_fill_header(RASTER3D_Map *map, int operation, int compression, int useRle, int useLzw, int type, int precision, int cache, int hasIndex, int useXdr, int typeIntern, int nofHeaderBytes, int tileX, int tileY, int tileZ, int proj, int zone, double north, double south, double east, double west, double top, double bottom, int rows, int cols, int depths, double ew_res, double ns_res, double tb_res, char *unit, int vertical_unit, int version)
int version
Definition: raster3d.h:74
void Rast3d_make_mapset_map_directory(const char *)
#define RLE_STATUS_BYTES
void Rast3d_filename(char *, const char *, const char *, const char *)
Definition: filename.c:10
#define R_OK
Definition: dirent.c:21
#define NULL
Definition: ccmath.h:32
#define RASTER3D_REGION_WEST
void Rast3d_fatal_error(const char *,...) __attribute__((format(printf
int Rast3d_extern_length(int)
Definition: raster3d/misc.c:90
int currentIndex
Definition: raster3d.h:155
double north
Definition: raster3d.h:50
void * xdr
void Rast3d_error(const char *,...) __attribute__((format(printf
#define RASTER3D_REGION_TBRES
#define RASTER3D_USE_CACHE_YZ
Definition: raster3d.h:26
#define RASTER3D_VALID_XDR_OPTION(o)
#define RASTER3D_REGION_NSRES
#define DCELL_TYPE
Definition: raster.h:13
#define RASTER3D_REGION_NORTH
double west
Definition: raster3d.h:51
char * data
Definition: raster3d.h:152
void * tmpCompress
int Rast3d_key_set_string(struct Key_Value *, const char *, char *const *)
Definition: keys.c:114
#define RASTER3D_HEADER_DATA_OFFSET
double ew_res
Definition: raster3d.h:57
int tmpCompressLength
int compression
Definition: raster3d.h:113
int Rast3d_write_header(RASTER3D_Map *map, int proj, int zone, double north, double south, double east, double west, double top, double bottom, int rows, int cols, int depths, double ew_res, double ns_res, double tb_res, int tileX, int tileY, int tileZ, int type, int compression, int useRle, int useLzw, int precision, int dataOffset, int useXdr, int hasIndex, char *unit, int vertical_unit, int version)
int g3d_cache_default
Definition: defaults.c:67
#define RASTER3D_HEADER_VERTICAL_UNIT
int vertical_unit
Definition: raster3d.h:94
int Rast3d_read_header(RASTER3D_Map *map, int *proj, int *zone, double *north, double *south, double *east, double *west, double *top, double *bottom, int *rows, int *cols, int *depths, double *ew_res, double *ns_res, double *tb_res, int *tileX, int *tileY, int *tileZ, int *type, int *compression, int *useRle, int *useLzw, int *precision, int *dataOffset, int *useXdr, int *hasIndex, char **unit, int *vertical_unit, int *version)
char * unit
Definition: raster3d.h:93
#define RASTER3D_HEADER_USERLE
#define RASTER3D_HEADER_TILEX
int precision
Definition: raster3d.h:111
#define RASTER3D_MIN(a, b)
#define RASTER3D_HEADER_PRECISION
#define RASTER3D_NO_COMPRESSION
Definition: raster3d.h:14
#define RASTER3D_REGION_SOUTH
#define GPATH_MAX
Definition: gis.h:180
int Rast3d_init_fp_xdr(RASTER3D_Map *, int)
Definition: fpxdr.c:65
#define RASTER3D_USE_CACHE_XY
Definition: raster3d.h:24
#define RASTER3D_REGION_TOP
#define RASTER3D_USE_CACHE_Y
Definition: raster3d.h:22
int Rast3d_key_set_value(struct Key_Value *, const char *, const char *, const char *, int, int, const int *)
Definition: keys.c:124
int Rast3d_key_set_double(struct Key_Value *, const char *, const double *)
Definition: keys.c:102
void * Rast3d_realloc(void *, int)
Same as realloc (ptr, nBytes), except that in case of error Rast3d_error() is invoked.
void G_write_key_value_file(const char *, const struct Key_Value *)
Write key/value pairs to file.
Definition: key_value3.c:28
Definition: gis.h:512
int g3d_cache_max
Definition: defaults.c:68
RASTER3D_Region region
Definition: raster3d.h:84
#define RASTER3D_HEADER_HASINDEX
#define RASTER3D_HEADER_TILEZ
#define RASTER3D_REGION_EAST
#define RASTER3D_REGION_BOTTOM
#define RASTER3D_REGION_EWRES
void G_warning(const char *,...) __attribute__((format(printf
void Rast3d_adjust_region(RASTER3D_Region *)
Computes an adjusts the resolutions in the region structure from the region boundaries and number of ...
Definition: region.c:151
int Rast3d_cache_size_encode(int cacheCode, int n)
Returns a number which encodes multiplicity n of cacheCode. This value can be used to specify the siz...
#define RASTER3D_HEADER_USEXDR
int Rast3d_init_index(RASTER3D_Map *, int)
#define RASTER3D_REGION_PROJ
Definition: path.h:16
int tileSize
Definition: raster3d.h:179
#define RASTER3D_REGION_COLS
#define RASTER3D_HEADER_VERSION
#define RASTER3D_HEADER_UNIT
#define _(str)
Definition: glocale.h:10
#define RASTER3D_REGION_DEPTHS
#define FCELL_TYPE
Definition: raster.h:12
char * G_store(const char *)
Copy string to allocated memory.
Definition: strings.c:87
int Rast3d_key_get_double(struct Key_Value *, const char *, double *)
Definition: keys.c:26
struct Key_Value * G_create_key_value(void)
Allocate and initialize Key_Value structure.
Definition: key_value1.c:23
int Rast3d_rewrite_header(RASTER3D_Map *map)
int Rast3d_key_get_int(struct Key_Value *, const char *, int *)
Definition: keys.c:7
#define RASTER3D_HEADER_COMPRESSION
int Rast3d__compute_cache_size(RASTER3D_Map *map, int cacheCode)
#define RASTER3D_HEADER_TYPE
char * mapset
Definition: raster3d.h:78
#define RASTER3D_HEADER_ELEMENT
Definition: raster3d.h:35
#define RASTER3D_NO_CACHE
Definition: raster3d.h:19
int Rast3d_key_get_value(struct Key_Value *, const char *, char *, char *, int, int, int *)
Definition: keys.c:64
double south
Definition: raster3d.h:50
void G_free_key_value(struct Key_Value *)
Free allocated Key_Value structure.
Definition: key_value1.c:103
#define RASTER3D_MAX(a, b)
#define RASTER3D_REGION_ZONE
int Rast3d_length(int)
Definition: raster3d/misc.c:78