Skip to content

feat: vector visParams support and style#447

Merged
zacdezgeo merged 8 commits into
mainfrom
fix-vector-vis
Jun 1, 2026
Merged

feat: vector visParams support and style#447
zacdezgeo merged 8 commits into
mainfrom
fix-vector-vis

Conversation

@XavierCLL
Copy link
Copy Markdown
Collaborator

visParams were not implemented for FeatureCollection vector layers. Even simple examples like the following were displayed with a random/default color:

import ee
from ee_plugin import Map
countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017")
country = countries.filter(ee.Filter.eq("country_na", "Ukraine"))
Map.addLayer(country, {"color": "orange"}, "feature_basic_color")

Previously, the feature was displayed with a random color. This PR implements styling support for FeatureCollection vector layers using GEE FeatureView-style visParams, including color, fill, stroke, opacity, width, and point/polygon/line styles.

Reference: https://developers.google.com/earth-engine/guides/featureview_styling

This PR only implements styling, not full FeatureView support; see #446.

Full GEE FeatureView support still needs to be implemented separately because it requires a different approach. The current FeatureCollection (vector) implementation downloads the vector data to a local GeoJSON file, which is very limited compared to Earth Engine’s optimized FeatureView tile rendering.

@XavierCLL XavierCLL requested a review from zacdezgeo May 25, 2026 03:39
@zacdezgeo
Copy link
Copy Markdown
Collaborator

i'll give a more thorough review tomorrow, seems to work after a quick check in QGIS. Here's the quick feedback from claude:

  • the style_params/vis_params mismatch in the vector add path,
  • making sure updated vector layers preserve EE custom properties for reload/update,
  • and tightening the docs/examples so they only claim support for the style keys that are actually forwarded today.

@XavierCLL
Copy link
Copy Markdown
Collaborator Author

Thanks @zacdezgeo those review issues/suggestions were implemented:

  • refresh layer panel icon when visParams is applying
  • update_ee_vector_layer re-inserts at the original layer tree slot
  • thread vis_params through the full vector add/update call chain
  • making sure updated vector layers preserve EE custom properties for reload/update
  • rewrite docs in the examples to explain local-vector vs catalog-tile

(I'm not sure why the pre-commit is failing, locally my branch pass all the ruff test, do you have any idea?)

XavierCLL and others added 7 commits May 27, 2026 10:42
- Implemented the GEE FeatureView visParams (color, fill, stroke,
  opacity, width, point/polygon/line style)
- Guard against bare hex colors, invalid values, and unsupported
  data-driven styles
- update_ee_vector_layer re-inserts at the original layer tree slot
- thread vis_params through the full vector add/update call chain
- making sure updated vector layers preserve EE custom properties for
  reload/update
- collapse duplicate key sets into a single ee_style_keys constant
- rewrite doc in the examples to explain local-vector vs catalog-tile
- Implemented the GEE FeatureView visParams (color, fill, stroke,
  opacity, width, point/polygon/line style)
- Guard against bare hex colors, invalid values, and unsupported
  data-driven styles
@zacdezgeo
Copy link
Copy Markdown
Collaborator

forced push to rebase off of changes in main @XavierCLL. I'm not sure what was going on with your local vs. remote branch, but pre-commit was failing on my end. I formatted the code with Ruff, and the CI is currently passing. I'll close #449 for now.

@zacdezgeo zacdezgeo mentioned this pull request May 27, 2026
Copy link
Copy Markdown
Collaborator

@zacdezgeo zacdezgeo left a comment

Choose a reason for hiding this comment

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

Looks much better now, and the earlier issues I flagged seem addressed. I just have one last concern before merge: in the named FeatureCollection/catalog tile path, the docs now say unsupported client-side-only style keys are silently ignored, but the implementation still appears to forward the original vis_params through the fallback branch when none of the .style()-supported keys are present. I think that path should consistently filter to the supported server-side keys and pass { } otherwise, so the behavior matches the docs. Other than that, this looks great!

@XavierCLL
Copy link
Copy Markdown
Collaborator Author

Hi @zacdezgeo you're right, what a good eye! fixed the fallback branch now passes {} instead of the raw vis_params, consistent with the .style()

@zacdezgeo zacdezgeo self-requested a review June 1, 2026 16:51
@zacdezgeo zacdezgeo merged commit 628c5ce into main Jun 1, 2026
4 checks passed
@zacdezgeo zacdezgeo deleted the fix-vector-vis branch June 1, 2026 17:23
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