Module:Infobox mapframe/doc
This is the documentation page for Module:Infobox mapframe
This Lua module is used on approximately 404,000 pages, or roughly 30% of all pages. To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
Related pages |
---|
Usage[edit source]
Module that automatically makes a mapframe suitable for an infobox automatically, with minimal user input.
Generic usage[edit source]
Just use the template {{Infobox mapframe}}, following the documentation there. This module may also be imported to another Lua module.
Automatic maps in infoboxes[edit source]
- Example edits: Template:Infobox prison, Template:Infobox prison/doc
Edit the infobox template (or its sandbox). Add lines like the following examples to the infobox. Replace numbers (4, or 97 to 99), with the appropriate number based on how many other image or data parameters are already present.
If placing near the top of infobox | If placing at/near the bottom of the infobox |
---|---|
| image4 = {{#invoke:Infobox mapframe|auto}} | caption4 = {{#invoke:Infobox mapframe|autocaption}} |
| header97 = {{#if:{{{mapframe|}}}|Location}} | data98 = {{#invoke:Infobox mapframe|auto}} | data99 = {{#invoke:Infobox mapframe|autocaption}} |
If the template has a {{#invoke:Check for unknown parameters}}
, add the following parameters:
| mapframe | mapframe-area_km2 | mapframe-area_mi2 | mapframe-caption | mapframe-coord | mapframe-coordinates | mapframe-custom | mapframe-frame-coord | mapframe-frame-coordinates | mapframe-frame-height | mapframe-frame-width | mapframe-geomask | mapframe-geomask-fill | mapframe-geomask-fill-opacity | mapframe-geomask-stroke-color | mapframe-geomask-stroke-colour | mapframe-geomask-stroke-width | mapframe-height | mapframe-id | mapframe-length_km | mapframe-length_mi | mapframe-marker | mapframe-marker-color | mapframe-marker-colour | mapframe-point | mapframe-shape | mapframe-shape-fill | mapframe-shape-fill-opacity | mapframe-stroke-color | mapframe-stroke-colour | mapframe-stroke-width | mapframe-switcher | mapframe-width | mapframe-wikidata | mapframe-zoom
Once this is done, the above parameters will be available to users of the template.
- Defaults values for these parameters can also be specified in the #invoke calls above, e.g.
{{#invoke:Infobox mapframe|auto|mapframe-marker=library}}
means that the library marker will be used, unless a different value is passed in to the template. - The maps are off by default, which means maps will not be displayed unless
|mapframe=yes
is present in the template call. To turn maps on by default, in the #invoke calls above add|onByDefault=yes
– which means maps will be displayed unless|mapframe=no
is present in the template call. onByDefault can also be set to a conditional, such as if another parameters is present, e.g.|onByDefault={{#if:{{{pushpin_map|}}}|no|yes}}
- Add the new parameters to the document. You can use
{{Infobox mapframe/doc/parameters}}
. Specify default values (if any are used in the #invoke calls) using by adding parameters in the form Page Template:Mono/styles.css must have content model "Sanitized CSS" for TemplateStyles (current model is "wikitext").
| parameter-namePage Template:Mono/styles.css must have content model "Sanitized CSS" for TemplateStyles (current model is "wikitext"). value. The default output is shown here collapsed:
Extended content
|
---|
to show shape/line features from the wikidata item, if any, when
. Use an inverse shape (geomask) instead of a regular shape by setting to
. Force point marker to be displayed by setting to
. Default: not specified
or
– switch geomasks found in Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (P276) and Lua error in Module:Wd at line 621: attempt to index field 'wikibase' (a nil value). (P131) statements on the page's Wikidata item, searching recursively. E.g. an item's city, that city's state, and that state's country.
– switch between the geomasks specified as a comma-separated list of Wikidata items (Q-numbers) in the mapframe-geomask parameter
– switch between "zoomed in"/"zoomed midway"/"zoomed out", where "zoomed in" is the default zoom (with a minimum of
), "zoomed out" is
to override any default marker symbol
mapframe-length_mi or mapframe-area_km2 or mapframe-area_mi2 – Determine zoom level by passing in object's length (in kilometres or miles) or area (in square kilometres or square miles). Default: not specified
|
- Parameters can also be added to the TemplateData can also be added by copy-pasting from
See also[edit source]