Module:Infobox mapframe/doc

From New Prairie Wiki
Revision as of 16:13, 13 July 2026 by Randombell (talk | contribs) (Created page with "{{Module rating|release}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see Wikipedia:Wikidata) --> {{Lua|Module:Mapframe|Module:InfoboxImage|Module:Infobox dim|Module:Yesno|Module:Arguments}} {{Lua sidebar}} This module implements {{tl|Infobox mapframe}}. See Template:Infobox mapframe/testcases for tests. == Usage == Module that automatically makes a mapframe suitable for an infobox automatically, with mi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is the documentation page for Module:Infobox mapframe

This module implements {{Infobox mapframe}}.

See Template:Infobox mapframe/testcases for tests.

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|autoWithCaption}}
| header97   = {{#if:{{{mapframe|}}}|Location}}
| data98     = {{#invoke:Infobox mapframe|autoWithCaption}}

If the template has a call to {{#invoke:Check for unknown parameters|check}}, simply add |mapframe_args=y to the call and the various mapframe args will automatically be included.

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
  | autoWithCaption
  | 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 template documentation.
    You can use {{Infobox mapframe/doc/parameters}}.
    If any default values are modified in the #invoke calls, add them as parameters in the form Template:Ttparameter-nameTemplate:Ttvalue.
    The default output is shown here collapsed:
Extended content
  • Basic {{Infobox mapframe}} parameters:
    • mapframe – Specify yes or no to show or hide the map, overriding the default. Default: no
      • Internal onByDefault parameter: not specified
    • 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 d:Property:P625
    • 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, most 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-wikidata – Set to yes to show all shape/line features from OpenStreetMap. 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.1
    • mapframe-stroke-color or mapframe-stroke-colour – Color of line features, and outlines of shape features. Default: #ff0000
      • mapframe-line-stroke-color or mapframe-line-stroke-colour – Color of line features. Default: #ff0000
      • mapframe-shape-stroke-color or mapframe-shape-stroke-colour – Color of outlines of shape features. Default: #ff0000
    • mapframe-stroke-width – Width of line features, and outlines of shape features. Default: 2
      • mapframe-shape-stroke-width – Width of outlines of shape features. Default: 2
      • mapframe-line-stroke-width – Width of line features. 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: 1
    • 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.25
    • 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 / not specified / not specified / 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
    • mapframe-type – Set the type of the object, with the same usage as {{coord}}. Default: not specified
    • mapframe-population – Set the population, useful with type="city", for {{Infobox dim}}. Default: not specified

See also