Skip to content

Date Range after iD update - #142

Merged
1ec5 merged 17 commits into
stagingfrom
gin-daterange-20221003
Oct 8, 2022
Merged

1ec5 merged 17 commits into
stagingfrom
gin-daterange-20221003

Conversation

@gregallensworth

@gregallensworth gregallensworth commented Oct 3, 2022 •

Copy link
Copy Markdown

Refer to OpenHistoricalMap/issues#395

  • reinstates the Date Range panel into the new iD
  • enhances Date Range to accept yyyy-mm-dd dates, and brings in decimaldate to compare day-level dates

@gregallensworth
gregallensworth marked this pull request as draft October 3, 2022 16:31
@gregallensworth
gregallensworth marked this pull request as ready for review October 3, 2022 18:40
Comment thread modules/renderer/features.js Resolved
Comment thread modules/renderer/features.js Resolved
Comment thread modules/ui/sections/map_daterange.js Resolved
Comment on lines +28 to +31
const section = uiSection('date_ranges', context)
.label(t('date_ranges.title'))
.disclosureContent(renderDisclosureContent)
.expandedByDefault(false);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, maybe we could consider replacing this separate section with a selectively disclosed row right under the “OpenHistoricalMap Data” checkbox in the Data Layers section. This would make the date filter more discoverable and also consistent with the street-level imagery date filter.

Comment thread modules/ui/sections/map_daterange.js Resolved
@danrademacher

Copy link
Copy Markdown

Comment thread data/core.yaml Resolved
Comment thread modules/renderer/features.js Resolved
Comment thread modules/renderer/features.js Resolved
Comment thread modules/ui/sections/map_daterange.js Resolved
@danrademacher

Copy link
Copy Markdown

I'm not reviewing this at code level but I have been testing locally, building on my comment above.

In this view, the Hotel Seattle in fact disappears, as it should.

But all these other things hand around:
image

I am digigng into it to understand why...

@1ec5

1ec5 commented Oct 4, 2022 •

Copy link
Copy Markdown
Member

@danrademacher I think that’s due to #142 (comment); the fix hasn’t been pushed yet.

Comment thread modules/ui/sections/map_daterange.js Resolved
@gregallensworth

Copy link
Copy Markdown
Author

I'm looking at http://localhost:8080/#background=Bing&daterange=0000-01-01,0000-12-31&disable_features=boundaries&id=w198794333&map=17.00/70.00269/-42.27294
And seeing this path that started in Year 30 image
Shouldn't that be filtered our by my filter to just Year 0?

Yes! I have the filtering really working this time. I was referring to the wrong commit in my notes yesterday, chased a red herring for some time.

Comment thread modules/renderer/features.js Resolved
Comment thread modules/renderer/features.js Resolved
Comment thread modules/renderer/features.js Resolved
Comment thread modules/ui/sections/map_daterange.js Resolved
Comment thread modules/renderer/features.js Resolved
Comment thread modules/renderer/features.js Resolved
Comment thread modules/renderer/features.js Resolved
Comment thread modules/renderer/features.js Resolved

@1ec5 1ec5 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for iterating on this PR. I think the only thing remaining is to see if we can minimize the number of times utilNormalizeDateString() gets called within featureFitsDateRange() (which is called frequently), partly by offloading some of that to ensureValidInputs().

Other than that, this should be good to merge. @danrademacher, have you gotten a chance to try it out again? I think it’s feeling pretty good at this point, but you seem to have the more extensive testbed. 😉

Comment thread modules/renderer/features.js Resolved
Comment thread modules/ui/sections/map_daterange.js Resolved

@1ec5 1ec5 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We’re so close – thank you for your detailed work on this feature. I can’t approve the PR, so here’s some final feedback while we wait for an approval.

Comment thread modules/renderer/features.js Resolved
@batpad

batpad commented Oct 7, 2022

Copy link
Copy Markdown

Just wanted to show my appreciation here 👏 this is fantastic work @1ec5 @gregallensworth - can't wait to see this go live.

Comment thread modules/ui/sections/map_daterange.js Resolved
1ec5 added 4 commits October 7, 2022 17:03
Moved the format to the placeholder for consistency with the Start Date and End Date inspector fields, and to avoid user confusion that the “e.g.” might need to be part of the input.
If a feature’s date range begins at the same time that the selected date range ends or vice versa, consider it an overlap and show the feature, because it may overlap at a higher precision expressed by the feature or filter.
Comment thread data/core.yaml
Comment on lines +951 to +952
tooltip: The end date in YYYY-MM-DD format, for example 1969-07-16. Use -0001 for the year 2 BCE.
placeholder: YYYY-MM-DD

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went to fix a typo but wound up swapping the example and format between the tooltip and placeholder. This makes the placeholder consistent with the placeholder in the Start Date and End Date fields of the inspector. I also added another example to illustrate negative years, since some mappers might be unaware of the potential for off-by-one error caused by Year 0.

Comment thread modules/renderer/features.js Resolved
Comment thread modules/renderer/features.js Resolved
1ec5 added 5 commits October 7, 2022 20:07
Avoid early returns based on whether any filters are enabled. This premature check resulted in vertices becoming unhidden independently of parent features based on whether the filters were enabled.

@1ec5 1ec5 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature seems to be working as advertised now, and it’s looking nicely polished thanks to @gregallensworth’s persistence. I’m going to keep kicking the tires on this one just in case, but we can address any remaining issues that come up in separate PRs.

Since we ended up implementing the filter as a special case instead of just another rule, there are changes scattered throughout features.js. We’ll need to be careful about testing this functionality the next time we do a major merge from upstream. I’ve added a cursory test of the date filtering functionality, but it doesn’t cover all the edge cases.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants