[GRASS5] G3D-api problem

Dear grass programmers,

Although not sure if this is the place for asking questions on the grass
api, not part of grass development..
I've asked the same question two weeks ago, and have not solved it yet..
Using the function G3d_writeTile (g3d_map, TileIndex, data, G3D_DOUBLE) to
write to a 3D grid I run into problems.
The program output offers:
FATAL ERROR: G3d_writeTile: tileIndex out of range. For a tileIndex of 3200.
The tileIndex is set with G3d_setTileDimension (128, 64, 201); since the
dimensions should be 128x64x201.
But somehow TileIndex = G3d_tile2tileIndex (g3d_map, ix, iy, iz) is not
allowed to supersede 3200 (16x8x25). For some unclear reason these
dimensions are set for the Tile. G3d_getNofTilesMap (g3d_map, &na, &nb, &nc)
offers 16 8 25.
Can anybody bring me a little further? How do I set the tileDimensions
properly so that I can have a tileIndex upto 128x64x201

With kindest regards,

Nico

Hi Markus, Nico

I didn't answer the mail on the mailinglist because I don't know/remember very much about tiles

but I've given a quick look to the libs and I hope what follows can help a bit.
(i've been a bit lazy, sorry! :wink:

the error:
"FATAL ERROR: G3d_writeTile: tileIndex out of range"
comes from
"tilewrite.c"
when
"if ((tileIndex >= map->nTiles) || (tileIndex < 0))"

in:
"g3ddefaults.c"
there are:
"#define G3D_TILE_X_DEFAULT 8"
"g3d_tile_dimension[0] = G3D_TILE_X_DEFAULT;"
"*tileX = g3d_tile_dimension[0];"

tileX is used in:
"header.c"
"map->tileX = tileX;"
"map->nx = (map->region.cols - 1) / tileX + 1;"
the same for y and z
"map->nxy = map->nx * map->ny"
"map->nTiles = map->nxy * map->nz;"

so it seems that the value of "map->nTiles" (which governs the fatal error) depends on the number of cols in the region and on the value of "tileX" which is set to 8 by default

hope this will be useful

Alfonso

Markus Neteler wrote:

Ciao Alfonso,

do you have a few hints for Nico? Something for him to
start looking for the bug?

Thanks,

Markus

From: "N.J. Hardebol" <harj@geo.vu.nl>
To: <grass5@grass.itc.it>

On Tue, Sep 16, 2003 at 01:39:53PM +0200, N.J. Hardebol wrote:

Dear grass programmers,

Although not sure if this is the place for asking questions on the grass
api, not part of grass development..
I've asked the same question two weeks ago, and have not solved it yet..
Using the function G3d_writeTile (g3d_map, TileIndex, data, G3D_DOUBLE) to
write to a 3D grid I run into problems.
The program output offers:
FATAL ERROR: G3d_writeTile: tileIndex out of range. For a tileIndex of 3200.
The tileIndex is set with G3d_setTileDimension (128, 64, 201); since the
dimensions should be 128x64x201.
But somehow TileIndex = G3d_tile2tileIndex (g3d_map, ix, iy, iz) is not
allowed to supersede 3200 (16x8x25). For some unclear reason these
dimensions are set for the Tile. G3d_getNofTilesMap (g3d_map, &na, &nb, &nc)
offers 16 8 25.
Can anybody bring me a little further? How do I set the tileDimensions
properly so that I can have a tileIndex upto 128x64x201

With kindest regards,

Nico