Skip to content

[Bug] r.category removes map title #7199

@petrasovaa

Description

@petrasovaa

Describe the bug

When you run r.support setting a raster title and then run r.category setting categories with labels, the title is empty afterwards

To reproduce

tools.r_proj(project="nlcd", mapset="PERMANENT", input="nlcd", output=landuse, resolution=30)
tools.r_support(map=landuse, title="USGS National Land Cover Data 2024")
categories = \
"""
0:Unclassified
11:Open Water
12:Perennial Snow/Ice
21:Developed, Open Space
22:Developed, Low Intensity
23:Developed, Medium Intensity
24:Developed, High Intensity
31:Barren Land
41:Deciduous Forest
42:Evergreen Forest
43:Mixed Forest
52:Shrub/Scrub
71:Grasslands/Herbaceous
81:Pasture/Hay
82:Cultivated Crops
90:Woody Wetlands
95:Emergent Herbaceous Wetlands
"""
tools.r_category(map=landuse, rules=io.StringIO(categories), separator=":")
tools.r_info(map=landuse, format="json")["title"]

and the result is empty string.

Additional context

I briefly looked into it and it seems there are 2 different titles - for categories and for the raster - Rast_set_cats_title and Rast_put_cell_title and they are both writing into the same file so that's the source of this. But I don't know whether both make sense, or which one is legacy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrasterRelated to raster data processing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions