Skip to content

Add tag-based search to feature list (e.g. building=yes)#11997

Open
VaibhavSingh2006 wants to merge 5 commits intoopenstreetmap:developfrom
VaibhavSingh2006:feature-tag-search
Open

Add tag-based search to feature list (e.g. building=yes)#11997
VaibhavSingh2006 wants to merge 5 commits intoopenstreetmap:developfrom
VaibhavSingh2006:feature-tag-search

Conversation

@VaibhavSingh2006
Copy link

@VaibhavSingh2006 VaibhavSingh2006 commented Mar 11, 2026

Fixes #11980

Adds support for searching features by tag in the feature list.

Users can now search using queries like:

  • building=yes
  • roof:shape=flat
  • highway=residential

Pressing Enter selects all matching entities within the current viewport.

I tested this by searching tags such as building=yes and roof:shape=flat.
The results update based on the current viewport (zoom level), and pressing Enter selects all matching features.

Screenshots of the behavior are attached for reference.

1).Zoomed
Screenshot 2026-03-11 at 2 33 41 PM

2).Normal
Screenshot 2026-03-11 at 2 33 12 PM

@valerio-bozzolan
Copy link

valerio-bozzolan commented Mar 11, 2026

Screenshots look nice! Can you share another small screenshot of the search box filled-in? (I don't get where is it)

@VaibhavSingh2006
Copy link
Author

VaibhavSingh2006 commented Mar 11, 2026

@valerio-bozzolan Thanks for the feedback!

Here is a screenshot showing the search box filled with the query building=yes in the feature list. The results update based on the current viewport, and pressing Enter selects all matching features.

Let me know if you'd like me to add more examples.

Screenshot 2026-03-11 at 11 36 38 PM Screenshot 2026-03-11 at 11 37 28 PM



function keypress(d3_event) {
var q = search.property('value'),

Choose a reason for hiding this comment

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

Please keep this line indented as it was before

(so diff is minimal)

same for other lines, if possible

@valerio-bozzolan
Copy link

I've added a comment on a specific line, but please consider improving indentation in general, so to have super-clean 'git diff', so other reviewers with +1 permissions are attracted

(I have no such permissions)

@VaibhavSingh2006
Copy link
Author

@valerio-bozzolan , Thanks for the suggestion! I restored the original indentation to keep the diff minimal.

@matkoniecz
Copy link
Contributor

There are still some whitespace changes.

@VaibhavSingh2006
Copy link
Author

@matkoniecz, Thanks for the feedback! I’ve cleaned up the remaining whitespace and indentation changes so the diff should now only contain the functional changes. Could you please take another look?

@matkoniecz
Copy link
Contributor

@VaibhavSingh2006
Copy link
Author

@matkoniecz can you check it now please!

@valerio-bozzolan
Copy link

Small code proposal: let's save the regex in one single place, like:

const tagRegex = /^([a-zA-Z0-9:_-]+)=([a-zA-Z0-9:_-]+)$/;

So to re-use it, like

const tagMatch = q.match(tagRegex);

etc.

@VaibhavSingh2006
Copy link
Author

@valerio-bozzolan, Thanks for the suggestion! I've moved the regex into a reusable constant and updated both usages.

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.

Select all features with a specific tag

3 participants