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

[Task] Remove ol-hash for viewer URLs #109

Open
mradamcox opened this issue Jan 19, 2023 · 1 comment
Open

[Task] Remove ol-hash for viewer URLs #109

mradamcox opened this issue Jan 19, 2023 · 1 comment
Labels
component: frontend effort: medium type: maintenance Underlying updates, upgrades, and general upkeep
Milestone

Comments

@mradamcox
Copy link
Collaborator

Describe the task
Currently, the location and zoom of the viewer page is pushed directly to the URL using the ol-hashed extension. Turns out, open layers has native capabilities for this using the Link. See example: https://openlayers.org/en/latest/examples/link.html?x=2508992.99979&y=943050.63366&z=5.10941&r=0&l=1

Completion criteria
Retain existing functionality, a URL can contain the x/y location and zoom of the viewer, but remove the ol-hashed library.

Additional context
Prefer built-in libraries instead of extensions. It looks like Link can also be used to retain layer presence, and this may be able to replace the existing layer opacity params. More likely, the Link layer param (l) will not be robust enough, in which case the layer param should be omitted.

@mradamcox
Copy link
Collaborator Author

Did some further looking into this the other day... OpenLayers Link has a very different URL pattern from what already exists (would break any existing links that people have bookmarked) and its url params have x/y in web mercator coords which is non-sensical to look at.

So now I'm leaning toward removing ol-hash altogether and just hand-writing a function to update the URL hash every time the map moves/zooms. This will be really simple actually, and also reduce dependencies. One existing behavior that I do want to change is that currently a new history entry is created everytime the map is moved (annoying) and it would be better to update the URL without adding a history entry.

@mradamcox mradamcox changed the title [Task] Implement OL Link instead of ol-hash for viewer URLs [Task] Remove ol-hash for viewer URLs Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: frontend effort: medium type: maintenance Underlying updates, upgrades, and general upkeep
Projects
None yet
Development

No branches or pull requests

1 participant