Skip to content

add time slider setting to OHM URL #108

Closed
Closed

Description

@rwelty1889

being able to include the time slider setting in the URL would make passing OHM links around just a little bit nicer

Activity

  1. jeffreyameyer commented on Jun 27, 2020

    @jeffreyameyer
    Member

    Related to #88, but that is not a dupe.

  2. added
    website
    on Jun 27, 2020
  3. jeffreyameyer commented on Jan 23, 2021

    @jeffreyameyer
    Member

    Actually, I believe this is a superset of #88, so I'll just add that here & close #88.

    What's your idea for a cool feature that would help you use OHM better.
    Right now, the map always defaults to a static year and date range, so you cannot share a particular year view of the map.

    It would be awesome to be able to embed the year of the map display in the URL.
    That way you could:

    • Link directly to ancient Rome
    • A civil war battlefield in the year of the battle
    • a year before a border changes

    Current workarounds
    Only to tell people when you pass them the link.

  4. jeffreyameyer commented on Jan 23, 2021

    @jeffreyameyer
    Member

    I believe @rwelty1889 wanted to be able to include the following in the URL as optional parameters:

    • Slider min
    • Slider max
    • Slider setting

    My question is whether it's possible to expose the current slider state to other apps/widgets, so the slider controls more than just the map? e.g. how do you make the inspector time-aware to show the most time-appropriate pictures by default? (that's not in this ticket, but a question)

  5. danrademacher commented on Jan 25, 2021

    @danrademacher

    This should be a separate and exploratory issue:

    My question is whether it's possible to expose the current slider state to other apps/widgets, so the slider controls more than just the map? e.g. how do you make the inspector time-aware to show the most time-appropriate pictures by default? (that's not in this ticket, but a question)

    the near term fix we need is to instantiate the urlHashReader and urlHashWritermethods we have documented here:
    https://github.com/OpenHistoricalMap/mbgl-timeslider#additional-tools-urlhashreader-and-urlhashwriter

    We have a demo here:
    https://openhistoricalmap.github.io/mbgl-timeslider/demo/

    This meets the requirement in this ticket for slider min, max, and setting.

    The task here is to see how it conflicts with the existing URL hash inohm-website and how we can resolve those conflicts with least possible change to default OSM website code

  6. jeffreyameyer commented on Jan 25, 2021

    @jeffreyameyer
    Member

    This should be a separate and exploratory issue:

    Done! #187

    Near-term fix sounds great!

  7. danrademacher commented on Jan 25, 2021

    @danrademacher

    I don't think this will be a pure implementation of the urlHashWriter/Reader we have on the timeslider right now.

    • Rails app expects a hash like this: #map=16/51.5292/-0.1543&layers=OD
    • Timeslider expects a hash like this: #16.6/40.8217108/-73.9119449/1980,1970-2000

    The layers=OD needs to be retained, since that's the map layer that's selected. There are other raster layers available where our timeslider disappears and you just have a usual Leaflet map, so they use the map= value as it is now.

    I wonder if the best approach with be a variant of the hadreader/writer that operates ONLY on the year pieces? So we do something like #map=16/51.5292/-0.1543&layers=OD&time=1980,1970-2000 and include options in the URL Hashwriter/reader that looks only for that?

    Just my first thought -- could be there's a simpler way to use what we have. Our goal is always to make as few changes as possible to the Rails app (eg change how it handles params), so it's easier to stay in sync with OSM upstream and manage OHM-speciifc code separately.

  8. added a commit that references this issue on Jan 26, 2021
  9. gregallensworth commented on Jan 26, 2021

    @gregallensworth

    This is in place in the new gda-timeslider-urlparams branch, itself a branch from new-inspector.

    The new hash components are more OSM-style rather than z/x/y style: a &date= and &daterange= parameter.

    http://localhost:3000/#map=21/47.60187/-122.33327&layers=O&date=1861&daterange=1750,1950

    • updates hash when map dragged, or slider changes
    • params applied on page load: date, daterange, both, neither
  10. danrademacher commented on Jan 26, 2021

    @danrademacher

    Looking good! In my local testing, the selected date hash is respected, but the RANGE is not always. If I reload the page, it all works as I expect, but if I select a non-time-aware basemap and then switch back to this map, the settings SOMETIMES revert to defaults.

    As shown in this screenscast, when I change the min date, then navigate away, the timeslider reverts to default:
    https://recordit.co/rdWoohYN96

  11. added a commit that references this issue on Jan 28, 2021
  12. danrademacher commented on Jan 29, 2021

    @danrademacher

    Hmm, a case where I can break the timeslider.

    Screencast: https://recordit.co/lLyC7Hh8xs

    If I load the page with either Humanitarian or Standard OSM, there's no time params loaded and then we get an error and no timeslider. Maybe we could load a default state if none are supplied in URL?

    1. Load this http://localhost:3000/#map=19/47.60187/-122.33395&layers=H
    2. Select Historical
    3. See no timeslider

    Can you base next change on this directly on new-inspector? I already merge dinto that, and once this bit is working, I'll merge it all into staging and run another deploy.

  13. added theissue type on Mar 16, 2025
  14. added and removed on Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

datestimesliderwebsite

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions