-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom features filter functionality #9584
base: develop
Are you sure you want to change the base?
Add custom features filter functionality #9584
Conversation
This looks like a nice addition. However, I think we should make sure that there are no side effects that might require additional work later … and if someone wants to invest this additional work. I could see this becoming a source of quite a few follow up feature requests and side effects with other features. Is there a way to test this now without running it locally / is there a preview URL? A quick list of thoughts:
|
@tordans Thanks for your comments.
I've deployed it on https://6446cbf640335e2652b8035f--bright-taffy-b33606.netlify.app
This is the part that doesn't make me entirely happy. To make it easier to be understood, I think the best solution would be to disable all the other options when the custom is selected, or move it to another section of the UI and make it override the Map Features preferences.
The custom filter is also stored in the URL and can be shared. It works the same way the custom background settings work. |
@@ -221,15 +221,20 @@ export function rendererFeatures(context) { | |||
return (geometry === 'line' || geometry === 'area'); | |||
}); | |||
|
|||
|
|||
defineRule('custom', function isCustom(tags) { | |||
const [key, value] = prefs('map-features-custom').split('='); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this feature, I'm using it in a fork of iD. There is a small bug though, prefs
can return null
when iD is opened for the first time, which causes a crash here. Something like this would fix it:
const [key, value] = prefs('map-features-custom').split('='); | |
const [key, value] = prefs('map-features-custom')?.split('=') || []; |
@k-yle what is your experience with this in your fork, is it ready to be merged or are there things we should address? I ran into the lacking filtering options again, today and it looks like this PR would be a solution for this. |
@tordans there are a few things I think we need to consider first:
I can't think of an easy way to implement the last point, but the other 3 are trivial changes |
Related to #2676. It adds a new option in the Map Features section that allows the user to set a key=value filter.
You can see it in action in the video below:
id-custom.mov