Skip to content

Add legend-based property styling for vector layers#743

Merged
jtroberts merged 2 commits into
developmentfrom
jr-709
Sep 3, 2025
Merged

Add legend-based property styling for vector layers#743
jtroberts merged 2 commits into
developmentfrom
jr-709

Conversation

@jtroberts

@jtroberts jtroberts commented Aug 30, 2025

Copy link
Copy Markdown
Member

Purpose

  • Adds a way to color vector layer features by property value and match legend entries

Proposed Changes

  • Updates the Legend tab in the Configure tool for administrator to define a Property Name, Property Value, whether to override the style based on the legend entry, and whether to hide the legend entry
  • If Shape==Continuous, we will interpolate between the two colors where the property value falls within
  • Works with numeric values or strings/booleans
  • For future development, we should consider how to make this play better with other Configuration tool fields, especially under the Style tab (currently the Legend values will override) and also how to make it easier to apply a color ramp like we do for raster layers.

Issues

Testing

  • Using continuous styling with a numeric value
Screenshot 2025-08-29 at 5 28 22 PM Screenshot 2025-08-29 at 5 27 18 PM
  • Using circle shapes with a string value
Screenshot 2025-08-29 at 5 28 39 PM Screenshot 2025-08-29 at 5 27 53 PM

@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2025

Copy link
Copy Markdown

@tariqksoliman tariqksoliman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtroberts During testing, I found it to not respect my continuous legend so I put a fix it.

I basically added a parseCSSColor function so that it handle CSS color names as well and prioritized the continuous mode and made it explicitly check the legend shape.

This was the legend object I was testing with:

[
    {
        "color": "purple",
        "strokecolor": "#000",
        "shape": "discreet",
        "value": "This",
        "propertyName": "",
        "propertyValue": "",
        "styleMatching": false
    },
    {
        "color": "cyan",
        "strokecolor": "#000",
        "shape": "discreet",
        "value": "is",
        "propertyName": "",
        "propertyValue": "",
        "styleMatching": false
    },
    {
        "color": "lime",
        "strokecolor": "#000",
        "shape": "discreet",
        "value": "a",
        "propertyName": "",
        "propertyValue": "",
        "styleMatching": false
    },
    {
        "color": " yellow",
        "strokecolor": "#000",
        "shape": "discreet",
        "value": "sentential"
    },
    {
        "color": "orange",
        "strokecolor": "#000",
        "shape": "discreet",
        "value": "example"
    },
    {
        "color": "red",
        "strokecolor": "#000",
        "shape": "discreet",
        "value": "of"
    },
    {
        "color": "purple",
        "strokecolor": "#000",
        "shape": "continuous",
        "value": "what",
        "propertyName": "site",
        "propertyValue": "0",
        "styleMatching": true
    },
    {
        "color": "red",
        "strokecolor": "#000",
        "shape": "continuous",
        "value": "values",
        "propertyName": "site",
        "styleMatching": true,
        "propertyValue": "40",
        "shapeIcon": ""
    },
    {
        "color": "white",
        "strokecolor": "#000",
        "shape": "continuous",
        "value": "the",
        "propertyName": "site",
        "styleMatching": true,
        "propertyValue": "80"
    },
    {
        "color": "blue",
        "strokecolor": "#000",
        "shape": "continuous",
        "value": "legend",
        "propertyName": "site",
        "propertyValue": "120",
        "styleMatching": true
    },
    {
        "color": "pink",
        "strokecolor": "#000",
        "shape": "circle",
        "value": "csv"
    },
    {
        "color": "green",
        "strokecolor": "#000",
        "shape": "discreet",
        "value": "files"
    },
    {
        "color": " orange",
        "strokecolor": "#000",
        "shape": "discreet",
        "value": "could"
    },
    {
        "color": "crimson",
        "strokecolor": "cyan",
        "shape": "square",
        "value": "possibly"
    },
    {
        "color": "indigo",
        "strokecolor": "#FFF",
        "shape": "rect",
        "value": "contain"
    }
]

With Claude 3.5 Bedrock

If this change didn't break anything new, feel free to merge. The only change I am requesting is that you retest. Thanks!

@jtroberts jtroberts merged commit f60d90d into development Sep 3, 2025
4 checks passed
@jtroberts

Copy link
Copy Markdown
Member Author

Thanks @tariqksoliman! I retested and it looks good to me.

@jtroberts jtroberts deleted the jr-709 branch September 3, 2025 00:54
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

Successfully merging this pull request may close these issues.

2 participants