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

SelectCluster caclulations should consider user projection #1102

Open
RamZal365 opened this issue Sep 9, 2024 · 1 comment
Open

SelectCluster caclulations should consider user projection #1102

RamZal365 opened this issue Sep 9, 2024 · 1 comment

Comments

@RamZal365
Copy link

Hi there,

We are using the animatedCluster feature of ol-ext in our project, and we realized that the animations and the final location of the points for the selectCluster interaction only work for the default projection (ESPG:3587). In our case we are using the function useGeographic (https://openlayers.vip/apidoc/module-ol_proj.html#.useGeographic) to make it so the map view uses geographic coordinates (even if the view projection is not geographic).

After debugging a bit, we realized that the error is found in the variables pix and res (lines 203 and 282 of SelectCluster.js) where it is assumed the Projection of the points to be the one of the View.

A fix suggestion would be to leverage the function getUserProjection to transform the resolution using the user's projection:
this.getMap().getView().getResolution() * this.getMap().getView().getProjection().getMetersPerUnit() / getUserProjection().getMetersPerUnit()

This is my first issue here, hope I made it clear enough, let me know if more info is required.
Thanks

@Viglino
Copy link
Owner

Viglino commented Sep 25, 2024

Last commit should solve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants