MapComplete/Docs/builtin_units.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

293 lines
4.3 KiB
Markdown
Raw Normal View History

2023-12-21 01:46:18 +01:00
[//]: # (WARNING: this file is automatically generated. Please find the sources at the bottom and edit those sources)
2024-07-12 03:16:41 +02:00
# Units
2024-07-16 19:31:00 +02:00
2024-05-07 00:41:59 +02:00
## Table of contents
2023-12-21 01:46:18 +01:00
2025-04-08 02:38:44 +02:00
1. [Units](#units)
- [How to use](#how-to-use)
2. [Rendering](#rendering)
3. [Usage](#usage)
- [unit](#unit)
+ [power](#power)
* [MW](#mw)
* [kW](#kw)
* [W](#w)
* [GW](#gw)
+ [voltage](#voltage)
* [V](#v)
+ [current](#current)
* [A](#a)
+ [distance](#distance)
* [m](#m)
* [cm](#cm)
* [mm](#mm)
* [ft](#ft)
+ [speed](#speed)
* [kmh](#kmh)
* [mph](#mph)
+ [duration](#duration)
* [minutes](#minutes)
* [hours](#hours)
* [days](#days)
* [weeks](#weeks)
* [months](#months)
* [years](#years)
## How to use
In some cases, a value is represented in a certain unit (such as meters for heigt/distance/..., km/h for speed, ...)
Sometimes, multiple denominations are possible (e.g. km/h vs mile/h; megawatt vs kilowatt vs gigawatt for power generators, ...)
This brings in some troubles, as there are multiple ways to write it (no denomitation, 'm' vs 'meter' 'metre', ...)
Not only do we want to write consistent data to OSM, we also want to present this consistently to the user.
This is handled by defining units.
# Rendering
To render a value with long (human) denomination, use {canonical(key)}
# Usage
First of all, you define which keys have units applied, for example:
```
units: [
appliesTo: ["maxspeed", "maxspeed:hgv", "maxspeed:bus"]
applicableUnits: [
...
]
]
```
ApplicableUnits defines which is the canonical extension, how it is presented to the user, ...:
```
applicableUnits: [
{
canonicalDenomination: "km/h",
alternativeDenomination: ["km/u", "kmh", "kph"]
default: true,
human: {
en: "kilometer/hour",
nl: "kilometer/uur"
},
humanShort: {
en: "km/h",
nl: "km/u"
}
},
{
canoncialDenomination: "mph",
... similar for miles an hour ...
}
]
```
If this is defined, then every key which the denominations apply to (`maxspeed`, `maxspeed:hgv` and `maxspeed:bus`) will be rewritten at the metatagging stage:
every value will be parsed and the canonical extension will be added add presented to the other parts of the code.
Also, if a freeform text field is used, an extra dropdown with applicable denominations will be given
Units
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
## unit
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
### power
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### MW
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
1MW = 1000000MW
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- megawatts
- megawatt
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### kW
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
1kW = 1000MW
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- kilowatts
- kilowatt
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### W
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- watts
- watt
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### GW
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
1GW = 1000000000MW
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- gigawatts
- gigawatt
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
### voltage
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### V
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- v
- volt
- voltage
- Volt
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
### current
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### A
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- a
- amp
- amperage
- A
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
### distance
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### m
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2024-07-12 03:16:41 +02:00
*Default denomination*
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- meter
- meters
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### cm
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
1cm = 0.01m
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- centimeter
- centimeters
- cms
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### mm
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
1mm = 0.001m
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- millimeter
- millimeters
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### ft
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
1ft = 0.3048m
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- feet
- voet
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
### speed
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### kmh
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- km/u
- km/h
- kph
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### mph
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2024-07-12 03:16:41 +02:00
Default denomination in the following countries:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- gb
- us
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- m/u
- mh
- m/ph
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
### duration
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### minutes
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- m
- min
- mins
- minuten
- mns
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### hours
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- h
- hrs
- hours
- u
- uur
- uren
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### days
2023-12-21 01:46:18 +01:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2024-07-12 03:16:41 +02:00
Alternative denominations:
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
- dys
- dagen
- dag
2023-12-21 01:46:18 +01:00
2024-07-12 03:16:41 +02:00
#### weeks
2024-04-28 01:49:01 +02:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2024-07-12 03:16:41 +02:00
#### months
2024-05-07 00:41:59 +02:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2024-07-12 03:16:41 +02:00
#### years
2024-05-07 00:41:59 +02:00
2025-05-19 23:05:37 +02:00
Validator is *float*
2023-12-21 01:46:18 +01:00
2025-04-08 02:38:44 +02:00
This document is autogenerated from [assets/layers/unit/unit.json](https://source.mapcomplete.org/MapComplete/MapComplete/src/branch/develop/assets/layers/unit/unit.json), [src/Models/ThemeConfig/Json/UnitConfigJson.ts](https://source.mapcomplete.org/MapComplete/MapComplete/src/branch/develop/src/Models/ThemeConfig/Json/UnitConfigJson.ts)