Skip to content

Make the date selector in ID work... #93

Closed
Closed

Description

@jeffreyameyer

id already has a date selector / filter, but using it doesn't seem to do anything...

See this example, where the start_date is set to 1921, but objects with end dates of 1920 still show up.

image

Activity

  1. danrademacher commented on Jun 12, 2020

    @danrademacher

    I'm confused. The screenshot just shows a tag applied to the selected object, right? It's not a filter of what's on the map at all, but rather just another, less formatted version of the tagged date above, where iD throws all tags attached to an object.

    I think date filtering inside iD would be a new feature request, best filed over in the iD repo. I recall discussions of this with Seth and iD has its own methods of fetching and rendering data, so our current timeline filter for vector tiles isn't immediately relevant.

  2. jeffreyameyer commented on Jun 18, 2020

    @jeffreyameyer
    MemberAuthor

    I think that's actually a filter for all the data shown in the editing window, which is why it's on the right-side panel, as opposed to somewhere else. All of the other elements on this panel relate to all data.

  3. danrademacher commented on Jun 18, 2020

    @danrademacher

    Oh I see! Sorry I missed that. And I see @jimmyrocks added it here:
    OpenHistoricalMap/iD@f94febf

    Hm, looking closer to see why that's not working

  4. danrademacher commented on Jan 20, 2021

    @danrademacher

    Picking this up again and also noted the older issue at #177.

    In this commit @jimmyrocks added the "Show all dates" and the date filter fields to core.yaml:
    OpenHistoricalMap/iD@1b5899e#diff-91dcbb736588a1ec670550f0d0b71c5acff2bf2a9d233cf591b4f22e74d0bc42

    But now we only have the one checkbox for the "show all"
    image

    We don't have the fields for start_date and end_date -- which is probably easy to fix by rechanging this YAML file, but I don't think the values in those fields didn't ever work.

    The goal in this issue would be that I can do the following:

    1. enter a start_date and see only data that starts on or after that date
    2. enter an end_date and see data that ends on or before that date

    One or both dates could be present, and if both are absent, all data is returned. So we need to be able to both get those fields back and apply >= and =< logic to them. Since iD is D3, this must be possible, but we also want to do it in the most iD-friendly way that doesn't get us in trouble for future updates.

  5. danrademacher commented on Jan 22, 2021

    @danrademacher

    I had a bit of an unfortunate "aha" moment on this. Currently we are creating decimal_date values that are easy to sort and filter at the point of vector tile generation. We chose to do this because we thought these data are just for the timeslider and just for machine reading and rendering, and we shouldn't pollute the tags in OHM with math0based versions of user-entered content that also shouldn't be edited by users for us to be confident that the decimal_date values are consistently made by formula.

    That is I think still the right approach overall, esp using machine processes to make sortable date versions, BUT it means that when we want to filter by date in iD (or JOSM) we still just have the text strings to work with. I am not sure what approach is best here

  6. danrademacher commented on Feb 16, 2021

    @danrademacher

    We were just discussing on checkin and approach that seems best:

    1. Look into reimplementing these PG functions in JavaScript: https://github.com/OpenHistoricalMap/DateFunctions-plpgsql/blob/master/datefunctions.sql.
    2. Then get some examples form @geohacker of past work where they have modified iD in ways that make it possible/less painful to keep up with upstream.
  7. danrademacher commented on Feb 17, 2021

    @danrademacher

    Noting we're pretty far behind the upstream at https://github.com/OpenHistoricalMap/iD:
    4127 commits behind openstreetmap:develop

    So another case where we need to catch up, retain our measly 27 commits, before we start making new mods.

    Reading this bit: https://github.com/OpenHistoricalMap/iD/blob/staging/API.md#customized-deployments, not sure I'm getting anything there about how one does this without making future updates difficult.

  8. danrademacher commented on Feb 17, 2021

    @danrademacher

    I totally forgot about this: https://github.com/OpenHistoricalMap/decimaldate-javascript Is this what we need to apply this in JS within iD? Needs further study but seems promising on item 1 in #93 (comment).

    We later created the pad-date functions, https://github.com/OpenHistoricalMap/paddate-python, so I think we'd also need to re-implement those, but I suspect that's a light lift.

    The harder part is figuring out where we could intervene in iD to apply the decimaldate.iso2dec function and then filter on it. I'm wondering now about doing this outside of iD if we could simply load our own script that targets the D3 that iD has loaded already and filters it, so that one simply can't select stuff to edit it. In that case, maybe we could apply our timeslider directly to the page and make it act on D3 data in some way. Lots of handwaving there, but feeling a bit more plausible than just "customize iD in some way to transform and filter data".

    I think this is a case where we definitely want to allow users to disable timeslider and "show all", so for example they can fix date formatting.

  9. 16 remaining items

  10. added a commit that references this issue on Mar 16, 2021
  11. danrademacher commented on Mar 16, 2021

    @danrademacher

    Testing locally and looking good!

    For the screenshots below, I disabled the underlying map layer to focus attention on what is or is not on the map.

    Here's Seattle 1800-1850:
    image

    Compared to everything:
    image

    So overall, seems to be working.

    Looking for some test cases so we can look at edge issues:

    ✅ Has Start Date, no End date

    image

    Working as expected. Here

    ✅ Has End Date, no Start Date

    Here's one with Start Date and no End:
    http://localhost:8080/#background=none&daterange=-4000,2000&disable_features=boundaries&id=w198285108&map=16.00/47.5912/-122.3164

    image

    ✅ Has neither start nor end, should always appear

    This works as expected:
    image

    ❔ Has Year only in Start or End

    Need to find item like this to test

    ❔Has Year-Month in Start or End

    Need to find item like this to test

    🔴 Not sure why this one isn't working ✅ This is working fine, my brain was misfiring

    Here's a railway in Europe with a full start date but no end date, similar to things we saw working in Seattle:
    image

    This doesn't seem to be working as expected. I would expect the railway that started in 1856 to disappear from the edit window is my start date is <1856.

    Working just fine here:
    http://localhost:8080/#background=none&daterange=1850,1855&map=16.00/47.4730/9.4682

  12. gregallensworth commented on Mar 16, 2021

    @gregallensworth

    Has Year-Month in Start or End

    Current algorithm is to take the first 4 characters, so "2000-03" or "2000-03-01" are still simply the integer 2000 Confirmed by altering the features' tags in memory, though in reality I don't see any features to "really" test.

  13. gregallensworth commented on Mar 16, 2021

    @gregallensworth

    test with negative year < 0 B.C.E. dates

    I have an improvement for this, to properly extract the year from any string as well as to supply Infinity/-Infinity for empty dates.

  14. added a commit that references this issue on Mar 16, 2021
  15. gregallensworth commented on Mar 16, 2021

    @gregallensworth

    Not sure why this one isn't working

    The behavior is correct: 1858 - 1900, does overlap with 1856 - Infinity So the railroad should show, and does.

    The railroad should vanish when the End Date is < 1856, so we're looking at a slice of time before the railway was created. And this does appear to work: http://localhost:8080/#background=none&daterange=-4000,1855&map=16.00/47.4730/9.4682

  16. gregallensworth commented on Mar 30, 2021

    @gregallensworth

    Only when a Map Features category is a unchecked

    Confirmed a malfunction here: the date filter is ineffective if no Map Features checkbox is unchecked. That is: date filter only works if any Map Features checkbox is unchecked. That's because of the first line here which simply returns "no, it's not hidden" unless a category is hidden.

        features.isHiddenFeature = function(entity, resolver, geometry) {
            if (!_hidden.length) return false;
            if (!entity.version) return false;
            if (_forceVisible[entity.id]) return false;
            const matchesdatefilter = features.checkDateFilter(entity);
            if (! matchesdatefilter) return true;
            var matches = Object.keys(features.getMatches(entity, resolver, geometry));
            return matches.length && matches.every(function(k) { return features.hidden(k); });
        };
    

    Checked and confirmed, that _hidden is redefined by features.hidden() when the checkboxes change.

    So that's the first to-do:

    • removing if (!_hidden.length) return false; from here,
    • but also checking around to see what else could be broken by this.

    URL params

    The reason I never noticed this, is that when using standalone iD on localhost, there are some default behaviors that the "Boundaries" checkbox is always unchecked immediately after page load. Therefore, I have to contrive to check al of the Map Features and trigger this bug. So now I know...

    But this does beg a question, why none of iD's URL param behaviors are effective when used on staging under the /edit URI. This would include saving the date range filter, for example. Then again, if people aren't accustomed to having these checkboxes saved into URL params and loaded, maybe this is a no-op.

  17. danrademacher commented on Mar 30, 2021

    @danrademacher

    Regarding this question:

    But this does beg a question, why none of iD's URL param behaviors are effective when used on staging under the /edit URI. This would include saving the date range filter, for example. Then again, if people aren't accustomed to having these checkboxes saved into URL params and loaded, maybe this is a no-op.

    I think in a standard OSM flow, the URL params other than map center and zoom are not relevant. In the context of OHM, ideally we would pass time settings from view into edit, though I wonder if we should treat that as a separate issue/enhancement. Since iD filter is a range and timeslider is a single date slice, it's not immediately obvious what we'd pass in. Maybe the timeslider min and max?

  18. added a commit that references this issue on Mar 30, 2021
  19. danrademacher commented on Apr 6, 2021

    @danrademacher

    This is deployed and running on ohm-website. Will have a separate issue for iD in Tasking Maanger

  20. added theissue type on Mar 16, 2025
  21. 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

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions