ideditor / schema-builder

🏗🏷 Create tagging schemas for iD
ISC License
13 stars 16 forks source link

Add measurement field type #15

Open 1ec5 opened 3 years ago

1ec5 commented 3 years ago

iD’s implementations of the roadheight and roadspeed field types share a lot in common. Meanwhile, other fields would benefit from unit dropdowns too but would need a different set of units, for example the Max Weight field: openstreetmap/iD#6707. This category has more examples of measurement-typed keys. We should replace the roadheight and roadspeed field types with a more general measurement field type, along with a dimension property that can be set to one of several values like area and duration.

For dimension naming ideas, this CLDR file lists industry-recognized measure units, each of which starts with a category subtag.

1ec5 commented 2 years ago

As of openstreetmap/iD#8769, number fields apply localized number formatting, which is generally a user-friendly change from before. However, some fields commonly require the unit to be specified explicitly, which prevents iD from applying this formatting. As long as some numeric fields are localized and others are not, users could easily get confused.

Here are some existing fields that commonly require the unit to be explicitly indicated:

Here are some existing fields that have an implied metric unit, which presents a usability challenge to users in the United States and to some extent the United Kingdom. A dedicated measurement field type would enable iD to present a field that accepts values in customary or imperial units (and converts them behind the scenes if these units aren’t acceptable in OSM):

1ec5 commented 2 years ago

Possible values to allow in dimension based on the Unicode standard:

OpenStreetMap Unicode/CLDR
dimension usage
Distance over land (distance) length road
Distance over sea (seamark:light:range) length
Flow rate (flow_rate)
Frequency (frequency) frequency
Height (ele, maxheight) length vehicle
Incline (incline) `angle`[^angle]
Length (width) length vehicle
Length, small-scale (gauge) length
Power (generator:output:electricity) power default
Pressure (pressure) pressure default
Range (siren:range) length visiblty
Speed (maxspeed) speed default
Weight (maxweight) mass default
Voltage (voltage)

Looking at the CLDR unit preference data, I wonder if it makes more sense for iD to store the regional unit preferences directly instead of getting them from country-coder. It seems like a JSON port of the LDML unit preference format would have much less overhead.

[^angle]: OSM allows different angle units than CLDR.

tyrasd commented 2 years ago

For some tags (e.g. capacity for man_made=storage_tank), there exist an implicit unit (e.g. cubic meters) but other measurement types are allowed as well (e.g. weights in t or kg).

1ec5 commented 1 year ago

Some fields such as Max Stay (maxstay) express durations, which could also benefit from this field type or a dedicated duration field type.

/ref openstreetmap/iD#9387

tordans commented 5 months ago

Copying https://github.com/openstreetmap/id-tagging-schema/pull/1234#issuecomment-2131069853 here so we don't forget

When we get around to implementing a measurement field type for ideditor/schema-builder#15, one wrinkle will be that helipads in the United States are rated in (thousands of) pounds rather than short tons, and this is what’s visible in aerial imagery. iD will need to add lbs as a third unit option alongside st and kg. We should do this for mass measurements anyways, since weight limits on roads in some U.S. states are posted exclusively in pounds.