Module:Infobox mapframe/doc

From escforumwiki
Revision as of 14:38, 5 April 2023 by wikipedia>Paine Ellsworth (High-use template and update /doc)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is the documentation page for Module:Infobox mapframe

Usage

Module that automatically makes a mapframe suitable for an infobox automatically, with minimal user input.

Generic usage

Just use the template {{Infobox mapframe}}, following the documentation there. This module may also be imported to another Lua module.

Automatic maps in infoboxes

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 Template:Ttparameter-nameTemplate:Ttvalue. The default output is shown here collapsed:
Extended content

view · talk · edit

  • Basic parameters:
    • mapframe – Specify yes or no to show or hide the map, overriding the default. Default: no
    • mapframe-caption – Caption for the map. Default: blank (or if |mapframe-geomask= is set, "Location in geomask's label")
    • mapframe-custom – Use a custom map instead of the automatic mapframe. Specify either a {{maplink}} template, or another template that generates a mapframe map, or an image name. If used, the subsequent mapframe parameters will be ignored. Default: not specified
    • mapframe-id or id or qid – Id (Q-number) of Wikidata item to use. Default: item for current page
    • mapframe-coordinates or mapframe-coord or coordinates or coord – Coordinates to use, instead of any on Wikidata. Use the {{Coord}} template, e.g. |coord={{Coord|12.34|N|56.78|E}}. Default: coordinates from Wikidata
    • mapframe-wikidata – Set to yes to show shape/line features from the wikidata item, if any, when |coord= is set. Default: not specified
  • Customise which features are displayed:
  • Other optional parameters:
    • mapframe-frame-width or mapframe-width – Frame width. Default: 270
    • mapframe-frame-height or mapframe-height – Frame height. Default: 200
    • mapframe-shape-fill – Color used to fill shape features. Default: #606060
    • mapframe-shape-fill-opacity – Opacity level of shape fill, a number between 0 and 1. Default: 0.5
    • mapframe-stroke-color or mapframe-stroke-colour – Color of line features, and outlines of shape features. Default: #ff0000
    • mapframe-stroke-width – Width of line features, and outlines of shape features; default is "5". Default: 5
    • mapframe-marker – Marker symbol to use for coordinates; see mw:Help:Extension:Kartographer/Icons for options. Default: not specified (i.e. blank)
      • Can also be set to blank to override any default marker symbol
    • mapframe-marker-color or mapframe-marker-colour – Background color for the marker. Default: #5E74F3
    • mapframe-geomask-stroke-color or mapframe-geomask-stroke-colour – Color of outline of geomask shape. Default: #555555
    • mapframe-geomask-stroke-width – Width of outline of geomask shape. Default: 2
    • mapframe-geomask-fill – Color used to fill outside geomask features. Default: #606060
    • mapframe-geomask-fill-opacity – Opacity level of fill outside geomask features, a number between 0 and 1. Default: 0.5
    • mapframe-zoom – Set the zoom level, from "1" (map of earth) to "18" (maximum zoom in), to be used if the zoom level cannot be determined automatically from object length or area. Default: 10
    • mapframe-length_km or 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
    • mapframe-frame-coordinates or mapframe-frame-coord – Alternate latitude and longitude coordinates for initial placement of map, using {{coord}}. Default: derived from item coordinates

See also