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

feat(rasters): Support widget calculations on rasters #87

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

donmccurdy
Copy link
Member

@donmccurdy donmccurdy commented Jan 31, 2025

In large part, widgets for raster datasources reuse the same code implemented for quadbin tilesets (#50). To accomplish this, we pre-process each raster tile, creating a 'FeatureData' key/value object for each pixel in the raster, if not excluded by the spatial filter. Creating "an object per pixel" is far from ideal, and keeping a binary representation throughout widget calculations would greatly improve performance. However, I think it's better to keep the code aligned with quadbin tilesets right now — ideally any performance optimizations would benefit both. Use of web workers should prevent calculations from dragging down the web application, even if the calculations themselves are inefficient.

Changes:

  • Add WidgetRasterSource class
  • Add tileFeaturesRaster() function, doing the heavy lifting of extracting feature data for calculations from rasters
  • Add raster example
  • Minor changes to example widgets, making it easier to set category colors that match pixel colors for debugging

screenshot

@donmccurdy donmccurdy added the enhancement New feature or request label Feb 7, 2025
@donmccurdy donmccurdy force-pushed the feat/sc-459604/tileset-widgets branch from 9070e96 to 98664a1 Compare February 10, 2025 21:34
Base automatically changed from feat/sc-459604/tileset-widgets to main February 10, 2025 21:37
@donmccurdy donmccurdy force-pushed the feat/sc-442828/raster-widgets-v2 branch from ee3baa9 to c3de3c5 Compare February 10, 2025 21:43
Comment on lines -109 to -111
// TODO(cleanup): As an optional property, 'uniqueIdProperty' will be easy to forget.
// Would it be better to configure it on the source function, rather than separately
// on the layer and in 'loadTiles()'?
Copy link
Member Author

Choose a reason for hiding this comment

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

Removing this comment because uniqueIdProperty is inferred automatically in nearly all cases, the user shouldn't need to worry about it. In deck.gl this is a layer property, not a source/data property, and migrating that seems like too much of a breaking change for the benefit.

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

Successfully merging this pull request may close these issues.

1 participant