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 examples #31

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

juandjara
Copy link

@juandjara juandjara force-pushed the feature/spatial-index-widgets-examples branch from f09eb8f to addb30a Compare December 11, 2024 10:00
@juandjara juandjara marked this pull request as ready for review December 11, 2024 15:30
h3-widgets/index.html Outdated Show resolved Hide resolved
<p class="overline">Variable</p>
<select name="variable" id="variable" class="select"></select>
<p class="overline">Agreggation method applied</p>
<p><pre id="agg-method"></pre></p>
Copy link
Member

Choose a reason for hiding this comment

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

I think Prettier should flag this one too but just a heads up that the <pre/> cannot be inside a <p/>, maybe <code /> instead.

Copy link
Author

Choose a reason for hiding this comment

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

Well this was copied from the previous examples, but we can change it to code or just remove this section

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok! I'll defer to @srtena if he prefers something else, but your changes look good to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree it should be code... Those two old examples have a few other issues 🙃 I'll try to find some time to improve them but low priority

h3-widgets/index.ts Outdated Show resolved Hide resolved
debouncedRenderWidgets()
}
});

Copy link
Member

Choose a reason for hiding this comment

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

After zooming in to the southern tip part of Melilla, such that only one h3 bin is visible, I noticed that the total population in the tooltip doesn't match the formula widget:

Screenshot 2024-12-11 at 6 07 48 PM

This might happen if the resolution of the tiles doesn't match what the Widgets API computes? Sorry this one is tricky to reproduce... just want to be sure we have the request parameters correct.

Copy link
Author

Choose a reason for hiding this comment

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

This was also caused by the bug above. I think it might be resolved now.

Copy link
Member

Choose a reason for hiding this comment

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

This still occurs for me, but I can see now that it's zoom-level dependent. If I zoom in enough, both the widget and the tile will agree on the "3666" result. If I start zooming out, the widget result increases (as if it's fetching a larger H3 cell?) first, and the size of the H3 cell displayed on the map does not change until I've zoomed much farther out.

Copy link
Author

@juandjara juandjara Dec 17, 2024

Choose a reason for hiding this comment

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

Hi Don! I'm trying to replicate this and cannot make it. Maybe it is fetching some h3 cells that are behind the white panel ?

Copy link
Author

@juandjara juandjara Dec 17, 2024

Choose a reason for hiding this comment

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

If you have some time today maybe we could do a quick meet with some live debugging

Copy link
Member

Choose a reason for hiding this comment

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

I think it might be strictly a problem of the 'spatialFiltersResolution' changing at a time when the rendered tile H3 resolution has not changed. Here are two screenshots at slightly different zoom states, one matching and the other not:

Matching

aligned

Non-matching

misaligned

Maybe a next step would be just to see if the same thing currently happens in C4R? If so then at least we know it isn't a new problem.

Copy link
Member

Choose a reason for hiding this comment

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

After re-installing npm dependencies and getting latest @carto/api-client, unfortunately still seeing the same thing here.

Copy link
Member

Choose a reason for hiding this comment

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

As discussed earlier today – the same mismatch happens in Builder/C4R as well:

h3_mismatch.webm

So whatever else is going on here, you've implemented the logic consistently with C4R! Assuming the Builder/C4R behavior is fine for now, I think we should just add a comment to getSpatialFiltersResolution in the @carto/api-client PR to keep track of this info, but it doesn't need to block the changes for this initiative.

/cc @srtena @padawannn just FYI.

Copy link
Member

Choose a reason for hiding this comment

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

For future reference the demo is using carto-demo-data.demo_tables.derived_spatialfeatures_esp_h3res8_v1_yearly_v2, just south of Melilla.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed to keep that as a known issue

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.

LGTM for code review, after local testing, nice work!

/cc @srtena any other feedback on this one? I haven't reviewed text and styles closely, defer to you on those!

@srtena srtena force-pushed the feature/spatial-index-widgets-examples branch from 2045d60 to a8f4bcc Compare December 23, 2024 15:42
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.

3 participants