Id: Hide some preset fields by default

Created on 10 Mar 2018  Â·  4Comments  Â·  Source: openstreetmap/iD

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

4522

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.

field preset

Most helpful comment

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.

All 4 comments

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:

  1. You might want to make maxspeed:advisory visible in the US, hidden in a few other countries, and unavailable elsewhere.
  2. We do really need a checkbox to exclude bicycles from oneway in Europe, but it would be clutter in the US.
  3. Maxweight and maxaxleload should be visible in case of a bridge, but hidden elsewhere.
  4. Maxheight should be visible in case of a tunnel, or where a bridge intersects the highway, or a connected highway has a maxheight tag.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tordans picture tordans  Â·  3Comments

jidanni picture jidanni  Â·  3Comments

naoliv picture naoliv  Â·  3Comments

tordans picture tordans  Â·  3Comments

bhousel picture bhousel  Â·  3Comments