File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed
Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,13 @@ Build a bounding box URL using this page: https://osmlab.github.io/show-me-the-w
2323 - https://osmlab.github.io/show-me-the-way/#comment=missingmaps
2424 - ` comment=missingmaps ` , will only show changes where the changeset comment contained missingmaps somewhere
2525
26+ ### Filter by feature keys
27+
28+ - key={string}
29+ - Restrict viewing only edits where the changeset's features include keys equal to a string.
30+ - https://osmlab.github.io/show-me-the-way/#key=building
31+ - ` key=building ` , will only show changes where the changeset includes features with the key building
32+
2633### Change the playback speed
2734
2835- runTime={seconds}
Original file line number Diff line number Diff line change @@ -84,30 +84,32 @@ class Change {
8484
8585 isRelevant ( ) {
8686 return new Promise ( ( resolve ) => {
87- let relevant = false ;
87+ let commentRelevance = false ;
88+ let keyRelevance = false ;
8889 const mapElement = this . neu || this . old ;
8990
90- if ( this . context . comment == "" ) {
91+ if ( this . context . comment === "" && ! this . context . key ) {
9192 return resolve ( true ) ;
9293 }
9394
9495 this . fetchChangesetData ( mapElement . changeset )
9596 . then ( ( changesetData ) => {
96- relevant = (
97- changesetData . comment &&
98- changesetData . comment . toLowerCase ( )
99- . indexOf ( this . context . comment . toLowerCase ( ) ) > - 1
100- ) ;
10197
102- if ( ! relevant ) {
98+ commentRelevance =
99+ this . context . comment !== "" &&
100+ changesetData . comment ?. toLowerCase ( )
101+ . includes ( this . context . comment . toLowerCase ( ) ) || false ;
102+
103+ keyRelevance = Object . keys ( mapElement . tags ) . includes ( this . context . key ) ;
104+
105+ if ( ! ( commentRelevance || keyRelevance ) ) {
103106 console . log (
104107 "Skipping map element " + mapElement . id
105- + " because changeset " + mapElement . changeset
106- + " didn't match " + this . context . comment
108+ + " because it didn't match filters."
107109 ) ;
108110 }
109111
110- return resolve ( relevant ) ;
112+ return resolve ( commentRelevance | keyRelevance ) ;
111113 } ) ;
112114 } ) ;
113115 }
You can’t perform that action at this time.
0 commit comments