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

Spatial index widgets second proposal #35

Conversation

juandjara
Copy link
Contributor

Following up on the conversation here: #34

This is an alternative implementation for the feature of adding widgets to spatial index sources configuring spatial filter to work in that case

@juandjara juandjara requested a review from donmccurdy December 3, 2024 17:21
Copy link
Member

@donmccurdy donmccurdy left a comment

Choose a reason for hiding this comment

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

I think I prefer computing the spatialFilterResolution internally like this, thanks! This way the user can set the resolution explicitly if the want to, but they don't always need to have the right options to pass into a new function.

I'm not 100% sure about some of the properties moved around on SourceOptionalOptions here, but that's easier to review after merging on the feature branch so I'm not worried about it now.

@juandjara @srtena any other concerns or preferences?

Comment on lines 223 to 232
if (spatialFilter && source.spatialDataType !== 'geo') {
assert(
options.spatialFiltersResolution ?? viewState,
'spatialFiltersResolution or viewState is required for using spatialFilter with spatial indexes'
);
}

const spatialFiltersResolution = options.spatialFiltersResolution ?? (
getSpatialFiltersResolution({ source, viewState: viewState! })
);
Copy link
Member

Choose a reason for hiding this comment

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

Probably we can move the common validation into getSpatialFiltersResolution here, and call the function only if a spatial filter is being used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, good call

Copy link
Contributor Author

@juandjara juandjara Dec 4, 2024

Choose a reason for hiding this comment

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

In this case the assert message would need to change to something like
"viewState prop is required to compute automatic spatialFiltersResolution when using spatialFilter with spatial indexes. Either pass a spatialFiltersResolution prop or a viewState prop to avoid this error"

@juandjara juandjara merged commit d50d904 into feature/sc-454268/spatial-index-widgets Dec 4, 2024
@juandjara juandjara deleted the feature/spatial-index-widgets-second-proposal branch December 4, 2024 11:30
@juandjara juandjara mentioned this pull request Dec 4, 2024
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