Skip to content
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

WebGL / Rework symbol rendering to include circles with outlines, shapes and icons #14883

Merged
merged 11 commits into from
Aug 14, 2023

Conversation

jahow
Copy link
Contributor

@jahow jahow commented Jul 6, 2023

This PR significantly reworks how symbols are handled in the WebGL renderers. Symbol styles now use a format that is compatible with the "flat" style format used by Canvas renderers, and which looks like this:

const iconStyle = {
  'icon-src': '../data/icon.png',
  'icon-width': 40,
  'icon-height': 80,
  'icon-offset': [5, 10],
  'icon-size': [20, 40],
};

const circleStyle = {
  'circle-radius': ['get', 'size'],
  'circle-fill-color': 'rgba(120, 140, 255, 0.6)',
  'circle-stroke-width': 3,
  'circle-stroke-color': 'blue',
};

const starStyle = {
  'shape-points': 4,
  'shape-radius1': 12,
  'shape-radius2': 5,
  'shape-fill-color': 'orange',
};

The previous symbol style format is not supported anymore: using it will simply not show anything on screen.

New styling possibilities include:

  • circles with outline
  • regular shapes or stars with or without outlines
  • icons specified as path or Image, with displacement, offset, anchor etc.

image

Note: this will break existing applications using WebGLPointsLayer with the previous style format. I figured that since we're moving towards a new major version, it was the right time to introduce a breaking change (which only affects parts of the API marked as experimental anyway).

I added several rendering tests to better guarantee the output of the rendering in WebGL.

Remaining to do:

  • fix heatmap layer
  • fix remaining broken tests
  • update the change log

This work is sponsored by BSW-Hamburg and Landesbetrieb Geoinformation und Vermessung Hamburg.

@github-actions
Copy link

github-actions bot commented Jul 6, 2023

📦 Preview the website for this branch here: https://deploy-preview-14883--ol-site.netlify.app/.

@jahow jahow force-pushed the webgl-symbol-outline branch 6 times, most recently from 196c6cf to 1da1568 Compare July 12, 2023 07:31
@jahow jahow marked this pull request as ready for review July 12, 2023 10:44
@jahow
Copy link
Contributor Author

jahow commented Jul 12, 2023

This is ready for review, please let me know if I need to subdivide some commits further to make this easier to read, thanks in advance!

@tschaub
Copy link
Member

tschaub commented Aug 12, 2023

@jahow - this looks great! I meant to review it earlier, but then lost track of it.

changelog/upgrade-notes.md Outdated Show resolved Hide resolved
@jahow jahow merged commit c819bb2 into openlayers:main Aug 14, 2023
@jahow jahow deleted the webgl-symbol-outline branch August 14, 2023 08:25
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