-
Notifications
You must be signed in to change notification settings - Fork 16
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
Calculation of widget using maps API #658
Calculation of widget using maps API #658
Conversation
This pull request has been linked to Shortcut Story #304698: Backend-based widget calculation using spatialFilter parameter. |
Pull Request Test Coverage Report for Build 5016122094
💛 - Coveralls |
90a42a9
to
b6d0241
Compare
c48b227
to
32f47cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
const isGet = url.length + JSON.stringify(queryParams).length <= URL_LENGTH; | ||
if (isGet) { | ||
url += '?' + new URLSearchParams(queryParams).toString(); | ||
} else { | ||
// undo the JSON.stringify, @todo find a better pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't get much better because you have to measure size of GET
url few lines above and that must have proper url as input.
(btw, it should create proper URL first, measure and test and not rely of more less accourate assumptions that JSON.stringify(queryParams).
is same length as new URLSearchParams(queryParams).toString()
but that's other story)
This is done correctly in getStats
albeit it's not much more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to introduce an utility function for this, in a later PR.
…culation-using-spatialfilter
…culation-using-spatialfilter
Im my opinion, we're ready to merge this PR. |
…culation-using-spatialfilter
…culation-using-spatialfilter
0c015e0
to
0c18699
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 really nice job here!
Description
Shortcut: https://app.shortcut.com/cartoteam/story/304698
This introduces the possibility for widget to be calculated remotely, so using the maps API. It is the case today for global mode only. This PR adds supports for non-global widgets to offload calculation to the backed. This is also limited to non-tileset data source and data source using V3-API only.
When enabled, widgets are more reactive and don't need to wait for the complete dataset to be downloaded. In demo apps, widgets gets rendered before data is even shown on the map.
The point of control of the feature is the function
isRemoteCalculationSupported
. Note that each widget must have this possibility turned on as well, via the initialisation parameterattemptRemoteCalculation
, currently hardcoded totrue
for widgets that supports the feature.No change in public API expected. Carto 4 React users won't be able to control this feature.