Documentation regeneration

This commit is contained in:
pietervdvn 2021-10-11 23:46:58 +02:00
parent dce43b4556
commit 28ed52d4a9
3 changed files with 59 additions and 31 deletions

View file

@ -26,12 +26,16 @@ The following values are always calculated, by default, by MapComplete and are a
The latitude and longitude of the point (or centerpoint in the case of a way/area)
### _surface, _surface:ha
The surface area of the feature, in square meters and in hectare. Not set on points and ways
This is a lazy metatag and is only calculated when needed
### _length, _length:km
@ -40,6 +44,8 @@ The surface area of the feature, in square meters and in hectare. Not set on poi
The total length of a feature in meters (and in kilometers, rounded to one decimal for '_length:km'). For a surface, the length of the perimeter
### Theme-defined keys
@ -47,6 +53,8 @@ The total length of a feature in meters (and in kilometers, rounded to one decim
If 'units' is defined in the layoutConfig, then this metatagger will rewrite the specified keys to have the canonical form (e.g. `1meter` will be rewritten to `1m`)
### _country
@ -54,18 +62,15 @@ If 'units' is defined in the layoutConfig, then this metatagger will rewrite the
The country code of the property (with latlon2country)
### _isOpen, _isOpen:description
If 'opening_hours' is present, it will add the current state of the feature (being 'yes' or 'no')
### _width:needed, _width:needed:no_pedestrians, _width:difference
Legacy for a specific project calculating the needed width for safe traffic on a road. Only activated if 'width:carriageway' is present
This is a lazy metatag and is only calculated when needed
### _direction:numerical, _direction:leftright
@ -75,6 +80,8 @@ Legacy for a specific project calculating the needed width for safe traffic on a
_direction:numerical is a normalized, numerical direction based on 'camera:direction' or on 'direction'; it is only present if a valid direction is found (e.g. 38.5 or NE). _direction:leftright is either 'left' or 'right', which is left-looking on the map or 'right-looking' on the map
### _now:date, _now:datetime, _loaded:date, _loaded:_datetime
@ -82,6 +89,8 @@ _direction:numerical is a normalized, numerical direction based on 'camera:direc
Adds the time that the data got loaded - pretty much the time of downloading from overpass. The format is YYYY-MM-DD hh:mm, aka 'sortable' aka ISO-8601-but-not-entirely
### _last_edit:contributor, _last_edit:contributor:uid, _last_edit:changeset, _last_edit:timestamp, _version_number
@ -89,6 +98,8 @@ Adds the time that the data got loaded - pretty much the time of downloading fro
Information about the last edit of this object.
Calculating tags with Javascript
----------------------------------
@ -140,15 +151,15 @@ Some advanced functions are available on **feat** as well:
- distanceTo
- overlapWith
- closest
- closestn
- memberships
- score
### distanceTo
Calculates the distance between the feature and a specified point in kilometer. The input should either be a pair of coordinates, a geojson feature or the ID of an object
0. longitude
1. latitude
0. feature OR featureID OR longitude
1. undefined OR latitude
### overlapWith
@ -160,10 +171,21 @@ For example to get all objects which overlap or embed from a layer, use `_contai
### closest
Given either a list of geojson features or a single layer name, gives the single object which is nearest to the feature. In the case of ways/polygons, only the centerpoint is considered.
Given either a list of geojson features or a single layer name, gives the single object which is nearest to the feature. In the case of ways/polygons, only the centerpoint is considered. Returns a single geojson feature or undefined if nothing is found (or not yet laoded)
0. list of features
### closestn
Given either a list of geojson features or a single layer name, gives the n closest objects which are nearest to the feature (excluding the feature itself). In the case of ways/polygons, only the centerpoint is considered. Returns a list of `{feat: geojson, distance:number}` the empty list if nothing is found (or not yet loaded)
If a 'unique tag key' is given, the tag with this key will only appear once (e.g. if 'name' is given, all features will have a different name)
0. list of features or layer name
1. amount of features
2. unique tag key (optional)
3. maxDistanceInMeters (optional)
### memberships
Gives a list of `{role: string, relation: Relation}`-objects, containing all the relations that this feature is part of.
@ -171,12 +193,4 @@ For example to get all objects which overlap or embed from a layer, use `_contai
For example: `_part_of_walking_routes=feat.memberships().map(r => r.relation.tags.name).join(';')`
### score
Given the path of an aspected routing json file, will calculate the score. This score is wrapped in a UIEventSource, so for further calculations, use `.map(score => ...)`
For example: `_comfort_score=feat.score('https://raw.githubusercontent.com/pietervdvn/AspectedRouting/master/Examples/bicycle/aspects/bicycle.comfort.json')`
0. path
Generated from SimpleMetaTagger, ExtraFunction

View file

@ -5,11 +5,6 @@
### all_tags
Prints all key-value pairs of the object - used for debugging
name | default | description
------ | --------- | -------------
#### Example usage
`{all_tags()}`
@ -20,11 +15,10 @@ name | default | description
name | default | description
------ | --------- | -------------
image key/prefix | image | The keys given to the images, e.g. if <span class='literal-code'>image</span> is given, the first picture URL will be added as <span class='literal-code'>image</span>, the second as <span class='literal-code'>image:0</span>, the third as <span class='literal-code'>image:1</span>, etc...
smart search | true | Also include images given via 'Wikidata', 'wikimedia_commons' and 'mapillary
#### Example usage
`{image_carousel(image,true)}`
`{image_carousel(image)}`
### image_upload
Creates a button where a user can upload an image to IMGUR
@ -36,6 +30,17 @@ image-key | image | Image tag to add the URL to (or image-tag:0, image-tag:1 whe
#### Example usage
`{image_upload(image)}`
### wikipedia
A box showing the corresponding wikipedia article - based on the wikidata tag
name | default | description
------ | --------- | -------------
keyToShowWikipediaFor | wikidata | Use the wikidata entry from this key to show the wikipedia article for
#### Example usage
`{wikipedia()}` is a basic example, `{wikipedia(name:etymology:wikidata)}` to show the wikipedia page of whom the feature was named after. Also remember that these can be styled, e.g. `{wikipedia():max-height: 10rem}` to limit the height
### minimap
A small map showing the selected feature. Note that no styling is applied, wrap this in a div
@ -128,16 +133,25 @@ If you want to import a dataset, make sure that:
1. The dataset to import has a suitable license
2. The community has been informed of the import
3. The theme will filter out duplicate nodes4. All other requirements of the [import guidelines](https://wiki.openstreetmap.org/wiki/Import/Guidelines) have been followed
3. All other requirements of the [import guidelines](https://wiki.openstreetmap.org/wiki/Import/Guidelines) have been followed
There are also some technicalities in your theme to keep in mind:
1. The new point will be added and will flow through the program as any other new point as if it came from OSM.
This means that there should be a layer which will match the new tags and which will display it.
2. The original point from your geojson layer will gain the tag '_imported=yes'.
This should be used to change the appearance or even to hide it (eg by changing the icon size to zero)
3. There should be a way for the theme to detect previously imported points, even after reloading.
A reference number to the original dataset is an excellen way to do this
name | default | description
------ | --------- | -------------
tags | undefined | Tags to copy-specification. This contains one or more pairs (seperated by a `;`), e.g. `amenity=fast_food; addr:housenumber={number}`. This new point will then have the tags `amenity=fast_food` and `addr:housenumber` with the value that was saved in `number` in the original feature. (Hint: prepare these values, e.g. with calculatedTags)
tags | undefined | Tags to copy-specification. This contains one or more pairs (seperated by a `;`), e.g. `amenity=fast_food; addr:housenumber=$number`. This new point will then have the tags `amenity=fast_food` and `addr:housenumber` with the value that was saved in `number` in the original feature. (Hint: prepare these values, e.g. with calculatedTags)
text | Import this data into OpenStreetMap | The text to show on the button
icon | ./assets/svg/addSmall.svg | A nice icon to show in the button
minzoom | 18 | How far the contributor must zoom in before being able to import the point
#### Example usage
`{import_button(,Import this data into OpenStreetMap,./assets/svg/addSmall.svg)}`
Generated from UI/SpecialVisualisations.ts
`{import_button(,Import this data into OpenStreetMap,./assets/svg/addSmall.svg,18)}` Generated from UI/SpecialVisualisations.ts

View file

@ -161,7 +161,7 @@ Finally, the URL-hash is the part after the `#`. It is `node/1234` in this case.
overpassUrl
-------------
Point mapcomplete to a different overpass-instance. Example: https://overpass-api.de/api/interpreter The default value is _https://overpass-api.de/api/interpreter_
Point mapcomplete to a different overpass-instance. Example: https://overpass-api.de/api/interpreter The default value is _https://overpass-api.de/api/interpreter,https://overpass.kumi.systems/api/interpreter,https://overpass.openstreetmap.ru/cgi/interpreter_
overpassTimeout