2022-02-14 04:59:49 +01:00
Special tag renderings
2021-11-30 22:45:25 +01:00
========================
2022-02-14 04:59:49 +01:00
2022-04-03 03:49:09 +02:00
In a tagrendering, some special values are substituted by an advanced UI-element. This allows advanced features and visualizations to be reused by custom themes or even to query third-party API's.
General usage is `{func_name()}` , `{func_name(arg, someotherarg)}` or `{func_name(args):cssStyle}` . Note that you _do not_ need to use quotes around your arguments, the comma is enough to separate them. This also implies you cannot use a comma in your args
#### Using expanded syntax
Instead of using `{"render": {"en": "{some_special_visualisation(some_arg, some other really long message, more args)} , "nl": "{some_special_visualisation(some_arg, een boodschap in een andere taal, more args)}}, one can also write
2022-04-08 22:17:08 +02:00
`{"render":{"special":{"type":"some_special_visualisation","argname":"some_arg","message":{"en":"some other really long message","nl":"een boodschap in een andere taal"},"other_arg_name":"more args"}}}`
2022-04-03 03:49:09 +02:00
2022-01-14 19:34:00 +01:00
## Table of contents
2021-11-30 22:45:25 +01:00
2021-11-30 22:50:48 +01:00
1. [Special tag renderings ](#special-tag-renderings )
2022-04-03 03:49:09 +02:00
* [Using expanded syntax ](#using-expanded-syntax )
2021-11-30 22:45:25 +01:00
+ [all_tags ](#all_tags )
2022-02-14 04:59:49 +01:00
* [Example usage of all_tags ](#example-usage-of-all_tags )
2021-11-30 22:45:25 +01:00
+ [image_carousel ](#image_carousel )
2022-02-14 04:59:49 +01:00
* [Example usage of image_carousel ](#example-usage-of-image_carousel )
2021-11-30 22:45:25 +01:00
+ [image_upload ](#image_upload )
2022-02-14 04:59:49 +01:00
* [Example usage of image_upload ](#example-usage-of-image_upload )
2021-11-30 22:45:25 +01:00
+ [wikipedia ](#wikipedia )
2022-02-14 04:59:49 +01:00
* [Example usage of wikipedia ](#example-usage-of-wikipedia )
2022-05-06 17:26:00 +02:00
+ [wikidata_label ](#wikidata_label )
* [Example usage of wikidata_label ](#example-usage-of-wikidata_label )
2021-11-30 22:45:25 +01:00
+ [minimap ](#minimap )
2022-02-14 04:59:49 +01:00
* [Example usage of minimap ](#example-usage-of-minimap )
2021-11-30 22:45:25 +01:00
+ [sided_minimap ](#sided_minimap )
2022-02-14 04:59:49 +01:00
* [Example usage of sided_minimap ](#example-usage-of-sided_minimap )
2021-11-30 22:45:25 +01:00
+ [reviews ](#reviews )
2022-02-14 04:59:49 +01:00
* [Example usage of reviews ](#example-usage-of-reviews )
2021-11-30 22:45:25 +01:00
+ [opening_hours_table ](#opening_hours_table )
2022-02-14 04:59:49 +01:00
* [Example usage of opening_hours_table ](#example-usage-of-opening_hours_table )
2021-11-30 22:45:25 +01:00
+ [live ](#live )
2022-02-14 04:59:49 +01:00
* [Example usage of live ](#example-usage-of-live )
2021-11-30 22:45:25 +01:00
+ [histogram ](#histogram )
2022-02-14 04:59:49 +01:00
* [Example usage of histogram ](#example-usage-of-histogram )
2021-11-30 22:45:25 +01:00
+ [share_link ](#share_link )
2022-02-14 04:59:49 +01:00
* [Example usage of share_link ](#example-usage-of-share_link )
2021-11-30 22:45:25 +01:00
+ [canonical ](#canonical )
2022-02-14 04:59:49 +01:00
* [Example usage of canonical ](#example-usage-of-canonical )
2021-11-30 22:45:25 +01:00
+ [import_button ](#import_button )
2022-02-14 04:59:49 +01:00
* [Example usage of import_button ](#example-usage-of-import_button )
2021-12-11 02:52:51 +01:00
+ [import_way_button ](#import_way_button )
2022-02-14 04:59:49 +01:00
* [Example usage of import_way_button ](#example-usage-of-import_way_button )
2021-12-11 02:52:51 +01:00
+ [conflate_button ](#conflate_button )
2022-02-14 04:59:49 +01:00
* [Example usage of conflate_button ](#example-usage-of-conflate_button )
2021-11-30 22:45:25 +01:00
+ [multi_apply ](#multi_apply )
2022-02-14 04:59:49 +01:00
* [Example usage of multi_apply ](#example-usage-of-multi_apply )
2021-11-30 22:45:25 +01:00
+ [tag_apply ](#tag_apply )
2022-02-14 04:59:49 +01:00
* [Example usage of tag_apply ](#example-usage-of-tag_apply )
2021-11-30 22:45:25 +01:00
+ [export_as_gpx ](#export_as_gpx )
2022-02-14 04:59:49 +01:00
* [Example usage of export_as_gpx ](#example-usage-of-export_as_gpx )
2021-12-30 22:02:11 +01:00
+ [export_as_geojson ](#export_as_geojson )
2022-02-14 04:59:49 +01:00
* [Example usage of export_as_geojson ](#example-usage-of-export_as_geojson )
2021-12-30 22:02:11 +01:00
+ [open_in_iD ](#open_in_id )
2022-02-14 04:59:49 +01:00
* [Example usage of open_in_iD ](#example-usage-of-open_in_id )
2022-06-09 03:00:13 +02:00
+ [open_in_josm ](#open_in_josm )
* [Example usage of open_in_josm ](#example-usage-of-open_in_josm )
2021-11-30 22:45:25 +01:00
+ [clear_location_history ](#clear_location_history )
2022-02-14 04:59:49 +01:00
* [Example usage of clear_location_history ](#example-usage-of-clear_location_history )
2022-01-12 02:31:51 +01:00
+ [close_note ](#close_note )
2022-02-14 04:59:49 +01:00
* [Example usage of close_note ](#example-usage-of-close_note )
2022-01-12 02:31:51 +01:00
+ [add_note_comment ](#add_note_comment )
2022-02-14 04:59:49 +01:00
* [Example usage of add_note_comment ](#example-usage-of-add_note_comment )
2022-01-12 02:31:51 +01:00
+ [visualize_note_comments ](#visualize_note_comments )
2022-02-14 04:59:49 +01:00
* [Example usage of visualize_note_comments ](#example-usage-of-visualize_note_comments )
2022-01-12 02:31:51 +01:00
+ [add_image_to_note ](#add_image_to_note )
2022-02-14 04:59:49 +01:00
* [Example usage of add_image_to_note ](#example-usage-of-add_image_to_note )
2022-02-28 17:16:21 +01:00
+ [title ](#title )
* [Example usage of title ](#example-usage-of-title )
2022-06-04 16:56:15 +02:00
+ [nearby_images ](#nearby_images )
* [Example usage of nearby_images ](#example-usage-of-nearby_images )
+ [mapillary_link ](#mapillary_link )
* [Example usage of mapillary_link ](#example-usage-of-mapillary_link )
2021-12-12 02:59:59 +01:00
+ [auto_apply ](#auto_apply )
2022-02-14 04:59:49 +01:00
* [Example usage of auto_apply ](#example-usage-of-auto_apply )
2021-11-08 02:36:01 +01:00
2021-11-07 17:18:10 +01:00
2022-02-14 04:59:49 +01:00
### all_tags
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
Prints all key-value pairs of the object - used for debugging
2021-11-07 17:18:10 +01:00
2022-02-14 04:59:49 +01:00
#### Example usage of all_tags
2022-01-14 19:34:00 +01:00
2022-02-14 04:59:49 +01:00
`{all_tags()}`
2022-01-14 19:34:00 +01:00
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
### image_carousel
Creates an image carousel for the given sources. An attempt will be made to guess what source is used. Supported: Wikidata identifiers, Wikipedia pages, Wikimedia categories, IMGUR (with attribution, direct links)
2021-06-21 03:37:00 +02:00
name | default | description
------ | --------- | -------------
2022-04-03 03:49:09 +02:00
image_key | image,mapillary,image,wikidata,wikimedia_commons,image,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... Multiple values are allowed if ';'-separated
2022-02-14 04:59:49 +01:00
#### Example usage of image_carousel
`{image_carousel(image,mapillary,image,wikidata,wikimedia_commons,image,image)}`
2021-06-21 03:37:00 +02:00
2022-01-14 19:34:00 +01:00
2022-02-14 04:59:49 +01:00
### image_upload
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
Creates a button where a user can upload an image to IMGUR
2021-06-21 03:37:00 +02:00
name | default | description
------ | --------- | -------------
image-key | image | Image tag to add the URL to (or image-tag:0, image-tag:1 when multiple images are added)
2021-10-12 02:12:45 +02:00
label | Add image | The text to show on the button
2022-02-14 04:59:49 +01:00
2021-06-21 03:37:00 +02:00
2022-02-14 04:59:49 +01:00
#### Example usage of image_upload
2022-01-14 19:34:00 +01:00
2022-02-14 04:59:49 +01:00
`{image_upload(image,Add image)}`
2022-01-14 19:34:00 +01:00
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
### wikipedia
A box showing the corresponding wikipedia article - based on the wikidata tag
2021-10-11 23:46:58 +02:00
name | default | description
------ | --------- | -------------
2022-05-06 17:26:00 +02:00
keyToShowWikipediaFor | wikidata;wikipedia | Use the wikidata entry from this key to show the wikipedia article for. Multiple keys can be given (separated by ';'), in which case the first matching value is used
2022-02-14 04:59:49 +01:00
#### Example usage of wikipedia
`{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
2021-10-11 23:46:58 +02:00
2022-01-14 19:34:00 +01:00
2022-05-06 17:26:00 +02:00
### wikidata_label
Shows the label of the corresponding wikidata-item
name | default | description
------ | --------- | -------------
keyToShowWikidataFor | wikidata | Use the wikidata entry from this key to show the label
#### Example usage of wikidata_label
`{wikidata_label()}` is a basic example, `{wikipedia(name:etymology:wikidata)}` to show the label itself
2022-02-14 04:59:49 +01:00
### minimap
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
A small map showing the selected feature.
2021-06-24 14:03:02 +02:00
name | default | description
------ | --------- | -------------
2021-07-03 22:00:36 +02:00
zoomlevel | 18 | The (maximum) zoomlevel: the target zoomlevel after fitting the entire feature. The minimap will fit the entire feature, then zoom out to this zoom level. The higher, the more zoomed in with 1 being the entire world and 19 being really close
2021-06-24 14:03:02 +02:00
idKey | id | (Matches all resting arguments) This argument should be the key of a property of the feature. The corresponding value is interpreted as either the id or the a list of ID's. The features with these ID's will be shown on this minimap.
2022-02-14 04:59:49 +01:00
2021-06-24 14:03:02 +02:00
2022-02-14 04:59:49 +01:00
#### Example usage of minimap
2022-01-14 19:34:00 +01:00
2022-02-14 04:59:49 +01:00
`{minimap()}` , `{minimap(17, id, _list_of_embedded_feature_ids_calculated_by_calculated_tag):height:10rem; border: 2px solid black}`
2022-01-14 19:34:00 +01:00
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
### sided_minimap
A small map showing _only one side_ the selected feature. *This features requires to have linerenderings with offset* as only linerenderings with a postive or negative offset will be shown. Note: in most cases, this map will be automatically introduced
2021-10-28 03:21:17 +02:00
name | default | description
------ | --------- | -------------
2021-10-29 13:53:00 +02:00
side | _undefined_ | The side to show, either `left` or `right`
2022-02-14 04:59:49 +01:00
#### Example usage of sided_minimap
`{sided_minimap(left)}`
2021-10-28 03:21:17 +02:00
2022-01-14 19:34:00 +01:00
2022-02-14 04:59:49 +01:00
### reviews
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
Adds an overview of the mangrove-reviews of this object. Mangrove.Reviews needs - in order to identify the reviewed object - a coordinate and a name. By default, the name of the object is given, but this can be overwritten
2021-06-21 03:37:00 +02:00
name | default | description
------ | --------- | -------------
subjectKey | name | The key to use to determine the subject. If specified, the subject will be < b > tags[subjectKey]< / b >
2022-02-14 04:59:49 +01:00
fallback | _undefined_ | The identifier to use, if < i > tags[subjectKey]</ i > as specified above is not available. This is effectively a fallback value
2021-06-21 03:37:00 +02:00
2022-02-14 04:59:49 +01:00
#### Example usage of reviews
2022-01-14 19:34:00 +01:00
2022-02-14 04:59:49 +01:00
`{reviews()}` for a vanilla review, `{reviews(name, play_forest)}` to review a play forest. If a name is known, the name will be used as identifier, otherwise 'play_forest' is used
2022-01-14 19:34:00 +01:00
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
### opening_hours_table
Creates an opening-hours table. Usage: {opening_hours_table(opening_hours)} to create a table of the tag 'opening_hours'.
2021-06-21 03:37:00 +02:00
name | default | description
------ | --------- | -------------
key | opening_hours | The tagkey from which the table is constructed.
2022-02-14 04:59:49 +01:00
prefix | _empty string_ | Remove this string from the start of the value before parsing. __Note: use `&LPARENs` to indicate `(` if needed__
postfix | _empty string_ | Remove this string from the end of the value before parsing. __Note: use `&RPARENs` to indicate `)` if needed__
2022-02-04 01:21:45 +01:00
2022-02-14 04:59:49 +01:00
#### Example usage of opening_hours_table
2021-06-21 03:37:00 +02:00
2022-02-14 04:59:49 +01:00
A normal opening hours table can be invoked with `{opening_hours_table()}` . A table for e.g. conditional access with opening hours can be `{opening_hours_table(access:conditional, no @ &LPARENS, &RPARENS)}`
2022-01-14 19:34:00 +01:00
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
### live
Downloads a JSON from the given URL, e.g. '{live(example.org/data.json, shorthand:x.y.z, other:a.b.c, shorthand)}' will download the given file, will create an object {shorthand: json[x][y][z], other: json[a][b][c] out of it and will return 'other' or 'json[a][b][c]. This is made to use in combination with tags, e.g. {live({url}, {url:format}, needed_value)}
2021-06-21 03:37:00 +02:00
name | default | description
------ | --------- | -------------
2021-10-29 13:53:00 +02:00
Url | _undefined_ | The URL to load
Shorthands | _undefined_ | A list of shorthands, of the format 'shorthandname:path.path.path'. separated by ;
path | _undefined_ | The path (or shorthand) that should be returned
2022-02-14 04:59:49 +01:00
#### Example usage of live
2021-06-21 03:37:00 +02:00
2022-02-14 04:59:49 +01:00
{live({url},{url:format},hour)} {live(https://data.mobility.brussels/bike/api/counts/?request=live&featureID=CB2105,hour:data.hour_cnt; day:data.day_cnt;year:data.year_cnt,hour)}
2022-01-14 19:34:00 +01:00
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
### histogram
Create a histogram for a list of given values, read from the properties.
2021-06-21 03:37:00 +02:00
name | default | description
------ | --------- | -------------
2021-10-29 13:53:00 +02:00
key | _undefined_ | The key to be read and to generate a histogram from
2022-01-26 21:15:12 +01:00
title | _empty string_ | This text will be placed above the texts (in the first column of the visulasition)
countHeader | _empty string_ | This text will be placed above the bars
2022-02-14 04:59:49 +01:00
colors* | _undefined_ | (Matches all resting arguments - optional) Matches a regex onto a color value, e.g. `3[a-zA-Z+-]*:#33cc33`
#### Example usage of histogram
2021-06-21 03:37:00 +02:00
2022-02-14 04:59:49 +01:00
`{histogram('some_key')}` with properties being `{some_key: ['a','b','a','c']} to create a histogram
2022-01-14 19:34:00 +01:00
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
### share_link
Creates a link that (attempts to) open the native 'share'-screen
2021-06-21 03:37:00 +02:00
name | default | description
------ | --------- | -------------
2021-10-29 13:53:00 +02:00
url | _undefined_ | The url to share (default: current URL)
2022-02-14 04:59:49 +01:00
#### Example usage of share_link
2021-06-21 03:37:00 +02:00
2022-02-14 04:59:49 +01:00
{share_link()} to share the current page, {share_link(< some_url > )} to share the given url
2022-01-14 19:34:00 +01:00
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
### canonical
Converts a short, canonical value into the long, translated text
2021-06-24 14:03:02 +02:00
name | default | description
------ | --------- | -------------
2021-10-29 13:53:00 +02:00
key | _undefined_ | The key of the tag to give the canonical text for
2022-02-14 04:59:49 +01:00
#### Example usage of canonical
2021-06-24 14:03:02 +02:00
2022-02-14 04:59:49 +01:00
{canonical(length)} will give 42 metre (in french)
2022-01-14 19:34:00 +01:00
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
### import_button
2021-09-09 00:05:51 +02:00
2022-02-14 04:59:49 +01:00
This button will copy the point from an external dataset into OpenStreetMap
Note that the contributor must zoom to at least zoomlevel 18 to be able to use this functionality.
It is only functional in official themes, but can be tested in unoffical themes.
2021-12-11 02:52:51 +01:00
#### Specifying which tags to copy or add
2022-02-14 04:59:49 +01:00
The argument `tags` of the import button takes a `;` -seperated list of tags to add (or the name of a property which contains a JSON-list of properties).
2021-12-11 02:52:51 +01:00
2022-02-14 04:59:49 +01:00
These can either be a tag to add, such as `amenity=fast_food` or can use a substitution, e.g. `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.
2021-12-11 02:52:51 +01:00
If a value to substitute is undefined, empty string will be used instead.
This supports multiple values, e.g. `ref=$source:geometry:type/$source:geometry:ref`
2022-02-14 04:59:49 +01:00
Remark that the syntax is slightly different then expected; it uses '$' to note a value to copy, followed by a name (matched with `[a-zA-Z0-9_:]*` ). Sadly, delimiting with `{}` as these already mark the boundaries of the special rendering...
2021-12-11 02:52:51 +01:00
2022-02-14 04:59:49 +01:00
Note that these values can be prepare with javascript in the theme by using a [calculatedTag ](calculatedTags.md#calculating-tags-with-javascript )
2021-10-29 18:16:51 +02:00
#### Importing a dataset into OpenStreetMap: requirements
2021-09-18 02:29:47 +02:00
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
2022-02-14 04:59:49 +01:00
3. All other requirements of the [import guidelines ](https://wiki.openstreetmap.org/wiki/Import/Guidelines ) have been followed
2021-10-11 23:46:58 +02:00
There are also some technicalities in your theme to keep in mind:
2022-02-14 04:59:49 +01:00
1. The new feature 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 feature 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 excellent way to do this
4. When importing ways, the theme creator is also responsible of avoiding overlapping ways.
2021-11-07 16:34:51 +01:00
#### Disabled in unofficial themes
2021-10-29 18:16:51 +02:00
2022-02-14 04:59:49 +01:00
The import button can be tested in an unofficial theme by adding `test=true` or `backend=osm-test` as [URL-paramter ](URL_Parameters.md ).
The import button will show up then. If in testmode, you can read the changeset-XML directly in the web console.
In the case that MapComplete is pointed to the testing grounds, the edit will be made on https://master.apis.dev.openstreetmap.org
2021-12-11 02:52:51 +01:00
name | default | description
------ | --------- | -------------
2022-02-14 04:59:49 +01:00
targetLayer | _undefined_ | The id of the layer where this point should end up. This is not very strict, it will simply result in checking that this layer is shown preventing possible duplicate elements
tags | _undefined_ | The tags to add onto the new object - see specification above. If this is a key (a single word occuring in the properties of the object), the corresponding value is taken and expanded instead
2021-12-11 02:52:51 +01:00
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
2022-02-14 04:59:49 +01:00
snap_onto_layers | _undefined_ | If a way of the given layer(s) is closeby, will snap the new point onto this way (similar as preset might snap). To show multiple layers to snap onto, use a `;` -seperated list
2021-12-11 02:52:51 +01:00
max_snap_distance | 5 | The maximum distance that the imported point will be moved to snap onto a way in an already existing layer (in meters). This is previewed to the contributor, similar to the 'add new point'-action of MapComplete
2022-02-14 04:59:49 +01:00
note_id | _undefined_ | If given, this key will be read. The corresponding note on OSM will be closed, stating 'imported'
2022-04-03 03:49:09 +02:00
location_picker | photo | Chooses the background for the precise location picker, options are 'map', 'photo' or 'osmbasedmap' or 'none' if the precise input picker should be disabled
2022-02-14 04:59:49 +01:00
#### Example usage of import_button
2021-11-07 17:18:10 +01:00
2022-04-03 03:49:09 +02:00
`{import_button(,,Import this data into OpenStreetMap,./assets/svg/addSmall.svg,,5,,photo)}`
2022-01-14 19:34:00 +01:00
2021-12-11 02:52:51 +01:00
2022-02-14 04:59:49 +01:00
### import_way_button
2021-12-11 02:52:51 +01:00
2022-02-14 04:59:49 +01:00
This button will copy the data from an external dataset into OpenStreetMap
Note that the contributor must zoom to at least zoomlevel 18 to be able to use this functionality.
It is only functional in official themes, but can be tested in unoffical themes.
2021-10-29 18:16:51 +02:00
#### Specifying which tags to copy or add
2022-02-14 04:59:49 +01:00
The argument `tags` of the import button takes a `;` -seperated list of tags to add (or the name of a property which contains a JSON-list of properties).
2021-10-29 18:16:51 +02:00
2022-02-14 04:59:49 +01:00
These can either be a tag to add, such as `amenity=fast_food` or can use a substitution, e.g. `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.
2021-10-29 18:16:51 +02:00
If a value to substitute is undefined, empty string will be used instead.
This supports multiple values, e.g. `ref=$source:geometry:type/$source:geometry:ref`
2022-02-14 04:59:49 +01:00
Remark that the syntax is slightly different then expected; it uses '$' to note a value to copy, followed by a name (matched with `[a-zA-Z0-9_:]*` ). Sadly, delimiting with `{}` as these already mark the boundaries of the special rendering...
2021-10-29 18:16:51 +02:00
2022-02-14 04:59:49 +01:00
Note that these values can be prepare with javascript in the theme by using a [calculatedTag ](calculatedTags.md#calculating-tags-with-javascript )
2021-12-11 02:52:51 +01:00
#### Importing a dataset into OpenStreetMap: requirements
2021-11-07 17:18:10 +01:00
2021-12-11 02:52:51 +01:00
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
2022-02-14 04:59:49 +01:00
3. All other requirements of the [import guidelines ](https://wiki.openstreetmap.org/wiki/Import/Guidelines ) have been followed
2021-12-11 02:52:51 +01:00
There are also some technicalities in your theme to keep in mind:
2022-02-14 04:59:49 +01:00
1. The new feature 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 feature 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 excellent way to do this
4. When importing ways, the theme creator is also responsible of avoiding overlapping ways.
2021-12-11 02:52:51 +01:00
#### Disabled in unofficial themes
2022-02-14 04:59:49 +01:00
The import button can be tested in an unofficial theme by adding `test=true` or `backend=osm-test` as [URL-paramter ](URL_Parameters.md ).
The import button will show up then. If in testmode, you can read the changeset-XML directly in the web console.
In the case that MapComplete is pointed to the testing grounds, the edit will be made on https://master.apis.dev.openstreetmap.org
2021-09-18 02:29:47 +02:00
name | default | description
------ | --------- | -------------
2022-02-14 04:59:49 +01:00
targetLayer | _undefined_ | The id of the layer where this point should end up. This is not very strict, it will simply result in checking that this layer is shown preventing possible duplicate elements
tags | _undefined_ | The tags to add onto the new object - see specification above. If this is a key (a single word occuring in the properties of the object), the corresponding value is taken and expanded instead
2021-09-18 02:29:47 +02:00
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
2021-12-11 02:52:51 +01:00
snap_to_point_if | _undefined_ | Points with the given tags will be snapped to or moved
2022-02-28 17:16:21 +01:00
max_snap_distance | 0.05 | If the imported object is a LineString or (Multi)Polygon, already existing OSM-points will be reused to construct the geometry of the newly imported way
2021-12-11 02:52:51 +01:00
move_osm_point_if | _undefined_ | Moves the OSM-point to the newly imported point if these conditions are met
2022-02-28 17:16:21 +01:00
max_move_distance | 0.05 | If an OSM-point is moved, the maximum amount of meters it is moved. Capped on 20m
2022-02-14 04:59:49 +01:00
snap_onto_layers | _undefined_ | If no existing nearby point exists, but a line of a specified layer is closeby, snap to this layer instead
2021-12-11 02:52:51 +01:00
snap_to_layer_max_distance | 0.1 | Distance to distort the geometry to snap to this layer
2022-02-14 04:59:49 +01:00
#### Example usage of import_way_button
2021-12-11 02:52:51 +01:00
2022-02-28 17:16:21 +01:00
`{import_way_button(,,Import this data into OpenStreetMap,./assets/svg/addSmall.svg,,0.05,,0.05,,0.1)}`
2022-01-14 19:34:00 +01:00
2021-12-11 02:52:51 +01:00
2022-02-14 04:59:49 +01:00
### conflate_button
2021-12-11 02:52:51 +01:00
2022-02-14 04:59:49 +01:00
This button will modify the geometry of an existing OSM way to match the specified geometry. This can conflate OSM-ways with LineStrings and Polygons (only simple polygons with one single ring). An attempt is made to move points with special values to a decent new location (e.g. entrances)
Note that the contributor must zoom to at least zoomlevel 18 to be able to use this functionality.
It is only functional in official themes, but can be tested in unoffical themes.
2021-12-11 02:52:51 +01:00
#### Specifying which tags to copy or add
2022-02-14 04:59:49 +01:00
The argument `tags` of the import button takes a `;` -seperated list of tags to add (or the name of a property which contains a JSON-list of properties).
2021-12-11 02:52:51 +01:00
2022-02-14 04:59:49 +01:00
These can either be a tag to add, such as `amenity=fast_food` or can use a substitution, e.g. `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.
2021-12-11 02:52:51 +01:00
If a value to substitute is undefined, empty string will be used instead.
This supports multiple values, e.g. `ref=$source:geometry:type/$source:geometry:ref`
2022-02-14 04:59:49 +01:00
Remark that the syntax is slightly different then expected; it uses '$' to note a value to copy, followed by a name (matched with `[a-zA-Z0-9_:]*` ). Sadly, delimiting with `{}` as these already mark the boundaries of the special rendering...
2021-12-11 02:52:51 +01:00
2022-02-14 04:59:49 +01:00
Note that these values can be prepare with javascript in the theme by using a [calculatedTag ](calculatedTags.md#calculating-tags-with-javascript )
2021-12-11 02:52:51 +01:00
#### Importing a dataset into OpenStreetMap: requirements
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
2022-02-14 04:59:49 +01:00
3. All other requirements of the [import guidelines ](https://wiki.openstreetmap.org/wiki/Import/Guidelines ) have been followed
2021-12-11 02:52:51 +01:00
There are also some technicalities in your theme to keep in mind:
2022-02-14 04:59:49 +01:00
1. The new feature 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 feature 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 excellent way to do this
4. When importing ways, the theme creator is also responsible of avoiding overlapping ways.
2021-12-11 02:52:51 +01:00
#### Disabled in unofficial themes
2022-02-14 04:59:49 +01:00
The import button can be tested in an unofficial theme by adding `test=true` or `backend=osm-test` as [URL-paramter ](URL_Parameters.md ).
The import button will show up then. If in testmode, you can read the changeset-XML directly in the web console.
In the case that MapComplete is pointed to the testing grounds, the edit will be made on https://master.apis.dev.openstreetmap.org
2021-12-11 02:52:51 +01:00
name | default | description
------ | --------- | -------------
2022-02-14 04:59:49 +01:00
targetLayer | _undefined_ | The id of the layer where this point should end up. This is not very strict, it will simply result in checking that this layer is shown preventing possible duplicate elements
tags | _undefined_ | The tags to add onto the new object - see specification above. If this is a key (a single word occuring in the properties of the object), the corresponding value is taken and expanded instead
2021-12-11 02:52:51 +01:00
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
2022-02-14 04:59:49 +01:00
way_to_conflate | _undefined_ | The key, of which the corresponding value is the id of the OSM-way that must be conflated; typically a calculatedTag
#### Example usage of conflate_button
2021-09-18 02:29:47 +02:00
2022-02-14 04:59:49 +01:00
`{conflate_button(,,Import this data into OpenStreetMap,./assets/svg/addSmall.svg,)}`
2022-01-14 19:34:00 +01:00
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
### multi_apply
A button to apply the tagging of this object onto a list of other features. This is an advanced feature for which you'll need calculatedTags
2021-10-12 02:12:45 +02:00
name | default | description
------ | --------- | -------------
2022-02-14 04:59:49 +01:00
feature_ids | _undefined_ | A JSON-serialized list of IDs of features to apply the tagging on
keys | _undefined_ | One key (or multiple keys, seperated by ';') of the attribute that should be copied onto the other features.
2021-10-29 13:53:00 +02:00
text | _undefined_ | The text to show on the button
2022-02-14 04:59:49 +01:00
autoapply | _undefined_ | A boolean indicating wether this tagging should be applied automatically if the relevant tags on this object are changed. A visual element indicating the multi_apply is still shown
overwrite | _undefined_ | If set to 'true', the tags on the other objects will always be overwritten. The default behaviour will be to only change the tags on other objects if they are either undefined or had the same value before the change
#### Example usage of multi_apply
2021-10-12 02:12:45 +02:00
2022-02-14 04:59:49 +01:00
{multi_apply(_features_with_the_same_name_within_100m, name:etymology:wikidata;name:etymology, Apply etymology information on all nearby objects with the same name)}
2022-01-14 19:34:00 +01:00
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
### tag_apply
2021-10-29 18:16:51 +02:00
2022-02-14 04:59:49 +01:00
Shows a big button; clicking this button will apply certain tags onto the feature.
The first argument takes a specification of which tags to add.
These can either be a tag to add, such as `amenity=fast_food` or can use a substitution, e.g. `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.
2021-10-29 18:16:51 +02:00
If a value to substitute is undefined, empty string will be used instead.
This supports multiple values, e.g. `ref=$source:geometry:type/$source:geometry:ref`
2022-02-14 04:59:49 +01:00
Remark that the syntax is slightly different then expected; it uses '$' to note a value to copy, followed by a name (matched with `[a-zA-Z0-9_:]*` ). Sadly, delimiting with `{}` as these already mark the boundaries of the special rendering...
2021-10-29 18:16:51 +02:00
2022-02-14 04:59:49 +01:00
Note that these values can be prepare with javascript in the theme by using a [calculatedTag ](calculatedTags.md#calculating-tags-with-javascript )
2021-10-29 18:16:51 +02:00
name | default | description
------ | --------- | -------------
tags_to_apply | _undefined_ | A specification of the tags to apply
message | _undefined_ | The text to show to the contributor
image | _undefined_ | An image to show to the contributor on the button
2022-02-14 04:59:49 +01:00
id_of_object_to_apply_this_one | _undefined_ | If specified, applies the the tags onto _another_ object. The id will be read from properties[id_of_object_to_apply_this_one] of the selected object. The tags are still calculated based on the tags of the _selected_ element
#### Example usage of tag_apply
`{tag_apply(survey_date=$_now:date, Surveyed today!)}` , `{tag_apply(addr:street=$addr:street, Apply the address, apply_icon.svg, _closest_osm_id)
2022-02-04 01:21:45 +01:00
2022-01-14 19:34:00 +01:00
2022-02-14 04:59:49 +01:00
### export_as_gpx
2021-11-08 02:36:01 +01:00
2022-02-14 04:59:49 +01:00
Exports the selected feature as GPX-file
2021-11-30 22:45:25 +01:00
2022-02-14 04:59:49 +01:00
#### Example usage of export_as_gpx
2021-11-30 22:45:25 +01:00
2022-02-14 04:59:49 +01:00
`{export_as_gpx()}`
2021-11-30 22:45:25 +01:00
2022-01-14 19:34:00 +01:00
2022-02-14 04:59:49 +01:00
### export_as_geojson
2021-11-30 22:45:25 +01:00
2022-02-14 04:59:49 +01:00
Exports the selected feature as GeoJson-file
2021-12-30 22:02:11 +01:00
2022-02-14 04:59:49 +01:00
#### Example usage of export_as_geojson
2021-12-30 22:02:11 +01:00
2022-02-14 04:59:49 +01:00
`{export_as_geojson()}`
2021-12-30 22:02:11 +01:00
2022-01-14 19:34:00 +01:00
2022-02-14 04:59:49 +01:00
### open_in_iD
2021-12-30 22:02:11 +01:00
2022-02-14 04:59:49 +01:00
Opens the current view in the iD-editor
2021-12-30 22:02:11 +01:00
2022-02-14 04:59:49 +01:00
#### Example usage of open_in_iD
2021-12-30 22:02:11 +01:00
2022-02-14 04:59:49 +01:00
`{open_in_iD()}`
2021-12-30 22:02:11 +01:00
2022-01-14 19:34:00 +01:00
2022-06-09 03:00:13 +02:00
### open_in_josm
Opens the current view in the JOSM-editor
#### Example usage of open_in_josm
`{open_in_josm()}`
2022-02-14 04:59:49 +01:00
### clear_location_history
2021-12-30 22:02:11 +01:00
2022-02-14 04:59:49 +01:00
A button to remove the travelled track information from the device
#### Example usage of clear_location_history
`{clear_location_history()}`
### close_note
Button to close a note. A predifined text can be defined to close the note with. If the note is already closed, will show a small text.
2022-01-12 02:31:51 +01:00
name | default | description
------ | --------- | -------------
text | _undefined_ | Text to show on this button
icon | checkmark.svg | Icon to show
2022-03-24 19:59:57 +01:00
idkey | id | The property name where the ID of the note to close can be found
2022-01-12 02:31:51 +01:00
comment | _undefined_ | Text to add onto the note when closing
2022-03-24 19:59:57 +01:00
minZoom | _undefined_ | If set, only show the closenote button if zoomed in enough
zoomButton | _undefined_ | Text to show if not zoomed in enough
2022-02-14 04:59:49 +01:00
#### Example usage of close_note
2022-03-24 19:59:57 +01:00
`{close_note(,checkmark.svg,id,,,)}`
2022-01-12 02:31:51 +01:00
2022-01-15 02:55:52 +01:00
2022-02-14 04:59:49 +01:00
### add_note_comment
2022-01-12 02:31:51 +01:00
2022-02-14 04:59:49 +01:00
A textfield to add a comment to a node (with the option to close the note).
2022-01-12 02:31:51 +01:00
name | default | description
------ | --------- | -------------
Id-key | id | The property name where the ID of the note to close can be found
2022-02-14 04:59:49 +01:00
2022-01-12 02:31:51 +01:00
2022-02-14 04:59:49 +01:00
#### Example usage of add_note_comment
2022-01-15 02:55:52 +01:00
2022-02-14 04:59:49 +01:00
`{add_note_comment(id)}`
2022-01-15 02:55:52 +01:00
2022-01-12 02:31:51 +01:00
2022-02-14 04:59:49 +01:00
### visualize_note_comments
Visualises the comments for notes
2022-01-12 02:31:51 +01:00
name | default | description
------ | --------- | -------------
commentsKey | comments | The property name of the comments, which should be stringified json
start | 0 | Drop the first 'start' comments
2022-02-14 04:59:49 +01:00
#### Example usage of visualize_note_comments
`{visualize_note_comments(comments,0)}`
2022-01-12 02:31:51 +01:00
2022-01-15 02:55:52 +01:00
2022-02-14 04:59:49 +01:00
### add_image_to_note
2022-01-12 02:31:51 +01:00
2022-02-14 04:59:49 +01:00
Adds an image to a node
2022-01-12 02:31:51 +01:00
name | default | description
------ | --------- | -------------
Id-key | id | The property name where the ID of the note to close can be found
2022-02-14 04:59:49 +01:00
2022-01-12 02:31:51 +01:00
2022-02-14 04:59:49 +01:00
#### Example usage of add_image_to_note
2022-01-15 02:55:52 +01:00
2022-02-14 04:59:49 +01:00
`{add_image_to_note(id)}`
2022-01-15 02:55:52 +01:00
2022-01-12 02:31:51 +01:00
2021-12-12 02:59:59 +01:00
2022-02-28 17:16:21 +01:00
### title
Shows the title of the popup. Useful for some cases, e.g. 'What is phone number of {title()}?'
#### Example usage of title
`What is the phone number of {title()}` , which might automatically become `What is the phone number of XYZ` .
2022-06-04 16:56:15 +02:00
### nearby_images
A component showing nearby images loaded from various online services such as Mapillary. In edit mode and when used on a feature, the user can select an image to add to the feature
name | default | description
------ | --------- | -------------
mode | expandable | Indicates how this component is initialized. Options are:
- `open` : always show and load the pictures
- `collapsable` : show the pictures, but a user can collapse them
- `expandable` : shown by default; but a user can collapse them.
mapillary | true | If 'true', includes a link to mapillary on this location.
#### Example usage of nearby_images
`{nearby_images(expandable,true)}`
### mapillary_link
Adds a button to open mapillary on the specified location
name | default | description
------ | --------- | -------------
zoom | 18 | The startzoom of mapillary
#### Example usage of mapillary_link
`{mapillary_link(18)}`
2022-02-14 04:59:49 +01:00
### auto_apply
2022-06-22 20:30:48 +02:00
A button to run many actions for many features at once. To effectively use this button, you'll need some ingredients:
2022-01-26 21:40:38 +01:00
2022-06-22 20:30:48 +02:00
- A target layer with features for which an action is defined in a tag rendering. The following special visualisations support an autoAction: import_way_button, tag_apply
- A host feature to place the auto-action on. This can be a big outline (such as a city). Another good option for this is the layer
- [current_view ](./BuiltinLayers.md#current_view )
- Then, use a calculated tag on the host feature to determine the overlapping object ids
- At last, add this component
2021-12-12 02:59:59 +01:00
name | default | description
------ | --------- | -------------
target_layer | _undefined_ | The layer that the target features will reside in
target_feature_ids | _undefined_ | The key, of which the value contains a list of ids
2022-02-14 04:59:49 +01:00
tag_rendering_id | _undefined_ | The ID of the tagRendering containing the autoAction. This tagrendering will be calculated. The embedded actions will be executed
2021-12-12 02:59:59 +01:00
text | _undefined_ | The text to show on the button
icon | ./assets/svg/robot.svg | The icon to show on the button
2022-02-14 04:59:49 +01:00
2021-12-12 02:59:59 +01:00
2022-02-14 04:59:49 +01:00
#### Example usage of auto_apply
2021-12-12 02:59:59 +01:00
2022-02-14 04:59:49 +01:00
`{auto_apply(,,,,./assets/svg/robot.svg)}`
2021-12-12 02:59:59 +01:00
2022-02-15 00:11:11 +01:00
This document is autogenerated from [UI/SpecialVisualizations.ts ](https://github.com/pietervdvn/MapComplete/blob/develop/UI/SpecialVisualizations.ts )