Skip to content

Modify legend properties/layer properties #2275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hieutrn1205 opened this issue Apr 30, 2025 · 2 comments
Open

Modify legend properties/layer properties #2275

hieutrn1205 opened this issue Apr 30, 2025 · 2 comments

Comments

@hieutrn1205
Copy link

Hi all,

I'm having the issues with modifying the legend content. Especially the layer's title and the first title labels for instance: I want to change 5 to 0 - 5m, and the layer's title acea06 to another meaningful string.

I couldn't find any documentation on modifying the legend properties but only enable it on/off.

Image

@achapkowski
Copy link
Contributor

This is built off the renderer that you are using. You can modify the renderer's labels and re-add the data.

@hieutrn1205
Copy link
Author

hi @achapkowski , thanks for your help. I tried with the first layer to change the labels with the renderer but it's a raster (imagery layer) so when it's run, the labels are changed but the layer is not added to the map. The title is not changed as well.

unique_value_infos = [
    UniqueValueInfo(
        value=5,
        label="0 - 5m",
    ),
    UniqueValueInfo(
        value=10,
        label="5 - 10m",
    ),
    UniqueValueInfo(
        value=31,
        label="10 - 31m",
    )
]
uvr_lecz = UniqueValueRenderer(
    type="uniqueValue",
    field1="Service Pixel Value",
    uniqueValueInfos=unique_value_infos,
)


lecz_option = {
    "layerDefinition" : {
        "drawingInfo" : {
            "renderer" : uvr_lecz.dict(),
        },
        "name": "Low Elevation Coastal Zones",
    },
    "opacity" : 0.5,
}

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants