Skip to content

Zoom to fragment of <map-a href> else zoom to extent of linked resource #378

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

Closed
prushforth opened this issue Mar 30, 2021 · 4 comments · Fixed by #387
Closed

Zoom to fragment of <map-a href> else zoom to extent of linked resource #378

prushforth opened this issue Mar 30, 2021 · 4 comments · Fixed by #387
Labels

Comments

@prushforth
Copy link
Member

A page can have > 1 map on it, but it would be useful to be able to capture the URL fragment and set the map center or bounds based on the parameters found there.

Maybe it could be in the form of a script that is distributed with the custom elements set, that you could configure easily to "do something" with a page's URL fragment if doing something is possible i.e. the fragment parses as something recognizable as a zoom,lon,lat or bbox etc.

@Malvoz
Copy link
Member

Malvoz commented Mar 31, 2021

A few notes:

This is essentially Text Fragments, but for maps. Something similar has been proposed for videos (linking to a particular time in a particular video on a web page) but I don't think I need to reference that from here.

Related UCR sections:

Related MapML section: https://maps4html.org/MapML/spec/#fragments

Also, hopefully this shouldn't hijack the back button 😄

@Malvoz
Copy link
Member

Malvoz commented Mar 31, 2021

Something similar has been proposed for videos (linking to a particular time in a particular video on a web page)

I was surprised to learn that the Media Fragments URI spec actually is supported for video file URLs (although not embedded into pages) in most browsers.

If you visit this URL: https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.webm#t=2,4 the video should start playing at 2 seconds and stop playing at 4 seconds.

Perhaps one or both these related specs can serve as guidance, e.g. for fragment syntax.

@prushforth
Copy link
Member Author

Thanks, I do think these will help us think about what is possible. The bare video URL must work like a bare image/* URL, where the browser knows the video is the only one on the page, so its able to honour the fragment.

@prushforth prushforth changed the title Define the ability to parse the URL fragment and zoom to the parameters if applicable Zoom to fragment of <map-a href> else zoom to extent of linked resource Apr 8, 2021
@prushforth
Copy link
Member Author

Ahmad and I converted this issue to be specifically about links in maps from features to other map content / layers.

The default view-changing behaviour should be overridable by whoever puts the link in the feature. So if you want the map view to not change, you should be able to include a <map-a inplace href="..."><map-a> inplace attribute to tell the map not move. The default should definitely be to move, but I also think the inplace attribute should win / take precedence over both the fragment and the remote resource's extent.

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

Successfully merging a pull request may close this issue.

2 participants