[GRASS-dev] r.external no cats file?

Markus Metz markus.metz.giswork at googlemail.com
Wed Jun 29 05:21:36 EDT 2011

On Wed, Jun 29, 2011 at 12:23 AM, Glynn Clements
<glynn at gclements.plus.com> wrote:
> Markus Metz wrote:
>> When linking external raster maps with r.external, I have to manually
>> create a corresponding cats file, otherwise a number of modules, e.g.
>> d.rast do not work properly. Is there any reason why no corresponding
>> cats file is produced?
> IMHO, modules should not be required to explicitly write a cats file.
> GRASS 4.x is ancient history, and raster maps are no longer inherently
> category-based.
I think this is true for all modules creating regular raster maps
because a cats file is automatically generated by the library when a
new raster map is closed. r.external does not use Rast_close() and
creates all the support files itself, but not the cats file.

> Raster modules should only write a cats file if they actually have
> something meaningful to put in it.
> Either Rast_read_cats() should silently return an empty category
> structure if no cats file is present, or Rast_close() should
> automatically generate an empty cats file if no cats file was
> explicitly written.
This is what Rast_close() does, but r.external does not call
Rast_close(). Maybe it should?

Markus M

> I'm inclined towards the former, unless there might be cases where the
> distinction between "no category list" and "empty category list" would
> matter.
> --
> Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list