In many cases, it makes sense to offer a field in the “Add field” dropdown for a particular preset but not display it by default for every feature that uses the preset. The idea is to make the tag more discoverable (so users don’t have to know the raw tag name and values) but avoid making the field too prominent or take up valuable screen real estate (because the field wouldn’t apply to enough features).
Currently, it’s only possible to make a field behave this way by setting universal to true. However, that adds it to the “Add field” dropdown for all presets, whereas in the following cases, we only want it to be available on some presets:
https://github.com/openstreetmap/iD/issues/4816#issuecomment-366731895
https://github.com/openstreetmap/iD/issues/4722#issuecomment-366487679
Perhaps a preset JSON file could have an optional_fields property alongside the usual fields property. These optional fields could appear at the top of the “Add field” dropdown, above the universal fields.
Perhaps a preset JSON file could have an optional_fields property alongside the usual fields property. These optional fields could appear at the top of the “Add field” dropdown, above the universal fields.
I like this idea.. I'd even be ok with getting rid of "universal" fields, and just making each preset have an explicit optional_fields / more_fields array.
@bhousel yes, I think that would be a great feature!
We should also be able to hide/unhide or even disable/enable or modify a field based on country, or other field settings, or geometry.
For example:
I'd even be ok with getting rid of "universal" fields, and just making each preset have an explicit optional_fields / more_fields array.
Maybe, we should have both optional_fields and more fields array, and let the add fields dropdown show the items of the first array only initially, but show the content of both arrays when typing something in to search.
These are interesting examples to consider – thanks!
You might want to make maxspeed:advisory visible in the US, hidden in a few other countries, and unavailable elsewhere.
The nice thing about the “Add fields” dropdown is that any irrelevant fields in there don’t have a huge negative impact on the user experience. If you’re mapping in a country that has no concept of an advisory speed limit, that field would clutter up the dropdown a little bit, but at least you wouldn’t feel pressured to fill it in unnecessarily. That’s what I took away from the discussion in #4722, at least.
Maxheight should be visible in case of a tunnel, or where a bridge intersects the highway, or a connected highway has a maxheight tag.
This is a nice idea that extends #4139 to suggest individual fields, not just whole presets. Maybe by first implementing the basic required/optional field logic, we’ll get a better sense for which fields need more sophisticated logic. As with https://github.com/openstreetmap/iD/issues/4139#issuecomment-314964313, I think the ultimate goal would be something that we can express in the JSON files, without special cases in the JavaScript code.
Most helpful comment
I like this idea.. I'd even be ok with getting rid of "universal" fields, and just making each preset have an explicit
optional_fields/more_fieldsarray.