OGF:Automated tables and lists

From OpenGeofiction Encyclopedia
Jump to: navigation, 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).

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").

Add all data which show up in the list/table later on

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

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.

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).

Download only the relation to add a new member.

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

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:

automatic table from external data
The following data has been retrieved from this URL, using the External Data MediaWiki extension. Because the "query" is cached on the server, the server-side cache needs to be purged to get most up-to-the-second results. To purge the cache, use the "Refresh" link Refresh
Luciano's Potpourri shops
Name Country City Note Map
Luciano's Potpourri Mergany Brugham Best shop! OGFmapicon.png map
Luciano's Potpourri Viljanni Viljanni Best shop! OGFmapicon.png map
Luciano's Potpourri Mergany Gausbrug Best shop! OGFmapicon.png map


If you have any improvements, please add it on the talk page.