Welcome to the new OGF servers!
The map is open for editing! The wiki remains under construction during this phase of the migration, but the old wiki has been archived here.

Help:Automated wiki tables and lists

From OpenGeofiction
Jump to navigation Jump to search

After Luciano started with the excellent idea of using mapped data to directly create lists for the wiki, I write my first "tutorial" here. It is based on my own template, but as soon as you got the main ideas, you can also create your own templates if the existing ones do not meet all your requirements.

The following example describes the creation of a shop-list with JOSM.

Mapping first location

First we draw the location and create all usual tags (here: a shop with the name Luciano's Potpourri).

File:Ogf Automated tables and lists1.jpg
Node with "shop=convenience" and "name=the shop's name"

In addition, we have to add all data which should show up later on in the wiki list or table, e.g. the country's and city's name (here: the shop is opened in Brugham in Mergany, so we use "is_in:country=Mergany" and "is_in:city=Brugham").

File:Ogf Automated tables and lists2.jpg
Add all data which show up in the list/table later on

After that, we create a new relation and add the node/way.

File:Ogf Automated tables and lists3.jpg
New relation to collect all members, here the first shop.

After the upload, double-click on the relation in JOSM and press ctrl+c. Then change to the wiki and press ctrl+v. You see the corresponding relation number (here: in our case we receive "relation 65276"). The relation number is necessary to tell the wiki which relation should be displayed.

File:Ogf Automated tables and lists4.jpg
Successfull creation and upload of a single shop. We do not see the relation here.

Adding another location

To add a new shop to the list, we have to create the shop as shown before and add it to the same(!) relation. In order to do so, we first load the corresponding relation. This can be done by pressing ctrl+shif+o or selecting File > Download object. There you enter r+number of the relation (here:r65276).

File:Ogf Automated tables and lists5.jpg
Download only the relation to add a new member.

The creation of the object (node/way) with corresponding tags was described above.

File:Ogf Automated tables and lists6.jpg
A new shop is created and added to the relation, of course with all data which should be displayed in the table.

Double-click on the relation in JOSM and press ctrl+c. Then change to the wiki and press ctrl+v. You see the corresponding relation number (here: in our case we receive "relation 65276"). The relation number is necessary to tell the wiki which relation should be displayed.

Using an automated table

After we get the relation number (here: 65276), all members can be displayed in the wiki by using an automated table template. In addition, the member type must be defined: are the members nodes or ways (here: nodes)?

Then for each column in the table a name must be defined and the corresponding node/way tag which should show up there. Here: the first column is the shop's name, the table head should show "Name" and the value is defined by the tag "name". So we use "column1name = Name" and "column1tag = name". The same procedure is done for the second column, where the "Country" is listed, defined by the tag "is_in:country" and so on. Up to ten columns are possible in this template. If some columns should not be sortable (here: the fourth column) we use "column4sort = no".).

This is how the code looks like:

{{MER-autoTable_adv
| relation    = 65276
| type        = node
| topic       = Luciano's Potpourri shops
| width       = 550
| column1name = Name
| column1tag  = name
| column2name = Country
| column2tag  = is_in:country
| column3name = City
| column3tag  = is_in:city
| column4sort = no
| column4name = Note
| column4tag  = ldata:note
}}

And this is the final result: Template:MER-autoTable adv

If you have any improvements, please add it on the [[Talk:OGF:Automated_tables_and_lists|talk page]].