Template:OSM Location map
This template is used on approximately 6,200 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Technical issue
New version now live, as of 11th March 2024! On 18th April 2023, a technical issue resulted in Wikimedia disabling the 'Graph' module on which these maps depended. Since that time the 'on-page' maps were not showing as editors will have intended. It is not looking like the Graph/Vega solution is going to be available in the near future. However it was finally worked out how to get round the problem, with a substantial re-write that utilises CSS graphics rather than the previous system. This has some benefits, and new features (and maybe a slightly faster load time due to lower overheads), and some challenges - particularly in connection with getting text sized and placed in the same way as the old system. It is looking stable, with the bigger wrinkles ironed out, but please do report anything noteworthy/problematic on the Talk page. Documentation update is underway...It includes additional graphical elements, and has allowed 'live' wikilinks on the map for the first time! See the Return to service article for details. |
Return to Service, 2024
For a full description of how this template has been able to return to something close to full functionality, and new options now possible, see Template:OSM Location map/Return to service. The documentation below has been updated and includes all the new possibilities, so can be used in conjunction with the above.
Documentation
This template provides
- A map (from OpenStreetMap) in a frame, for any location, anywhere in the world, at scale from global to an individual building.
- Optional multiple markers, text labels, numbered dots, live wikilinks and other graphical elements.
- A link (top right corner) to a fullscreen interactive version, which can have 'dots and details' from the article/map.
- A mini-locator map can be shown to provide context for the map.
Purpose
OSM Location map allows an editor to include a map in a frame with a zoom level appropriate to the topic. A scale marker is provided in the bottom right corner. This is at best a rough guide to the distances on the map, as the map projection results in scale changes depending on the latitude. Allowance has been made for this, but only in large 20 degree chunks.
The multiple marks, images and labels (currently limited to 60, and that might exceed size limits on very large pages) can be a shape or image, include a text label, and potentially 'pointer-lines' and other graphical elements. The fullscreen map on the other hand will show them as pointer marks, which can be given popup thumbnail images and captions, as well as providing links to access other maps and satellite images, and an option to show locations of other articles nearby.
A selection of example maps, along with links to an even wider range if use-types, is at Template:OSM Location map/examples.
Usage Examples
Scenario 1: Minimal version
An unadorned map centred on a latitude and longitiude coordinates, via a {{coord}} value. Set the zoom to give a scale that fits the subject (0=whole world, 18=a street). With just these options set, all other parameters use the defaults, or are left unused. It also gives a link to the interactive fullscreen version.
{{OSM Location map
| coord = {{coord|53.4146|-4.3341}} <!--latitude/longitude coordinates for map's center -->
| zoom = 15 <!--zoom 0=whole world, 18=a street.-->
}}
|
Scenario 2: Single marker with text label
A default 'Red pog' marker and accompanying label. Additional items (the last three parameters) don't show up on the page, but give extra information when hovering/clicking on a dot in the fullscreen version.
| mark-coord = {{coord|53.3966|-4.46204}}
| label = [[Llanfechell#Llanfechell Triangle|Llanfechell Triangle]] <!--text label hover title in default display can be relevant page in wikipedia-->
| label-pos = right <!--right, left, top, bottom-->
| mark-title = [[Llanfechell#Llanfechell Triangle|Llanfechell Triangle]] <!--fullscreen hover title -->
| mark-image = The Llanfechell Triangle - geograph.org.uk - 1260817.jpg
| mark-description=Prehistoric standing stones at [[Llanfechell]] <!--text shown in fullscreen mode when clicking on marker -->
|
The mark-title can optionally be wiki-linked, and the dot on the map becomes a live link, even if the page doesn't exist. The label can also be wiki-linked, but as in the case here will display the page that contains a subsection as the live link rather than a picture of the feature as is shown on full screen. It can work well when there is a page on the specific subject.
Blank code for a single marker map | Blank code with comments |
---|---|
{{OSM Location map
| coord = {{coord| | }}
| zoom =
| width =
| height =
| caption =
| label =
| mark-coord = {{coord| | }}
| label-pos =
| mark-title =
| mark-image =
| mark-description =
}}
|
{{OSM Location map
| coord = {{coord| | }} <!-- {{coord}} has various formats for latitude and longitude -->
| zoom = <!-- (0=whole world, 18=a street)-->
| width = <!-- width and height of the map, in pixels. Do not add px -->
| height = <!-- default is width=350, height=250 -->
| caption = <!-- Text below the map. Can include [[wikilinks]] -->
<!-- Parameters for 1st mark -->
| label = <!-- text alongside the mark which can include wikilink to name of page shown on hover-->
| mark-coord = {{coord| | }} <!-- lat and lon location for the marker -->
| label-pos = <!-- default position is left. It can also be right, top, bottom. -->
| mark-title = <!-- text shown on fullscreen map when hovering over or clicking on mark -->
| mark-image = <!-- image shown on fullscreen map when clicking on mark. Use a filename from Commons, without File: -->
| mark-description = <!-- text shown on fullscreen map when clicking on mark -->
}}
|
Multiple markers, labels and images
In addition to the un-numbered mark parameter set, there are 60 numbered ones. These are otherwise identical to the one above, but the name terminates in a number (1-60). Each mark and label has its own set of parameters (|mark1=
, |mark-coord1=
, |label1=
, |label-pos1=
etc...|mark2=
, |mark-coord2=
, |label2=
, |label-pos2=
etc.) Values can be inherited either from the 'mark1 master parameter set', or from a special 'markD' Default set that provides override defaults. When set, these values are inherited by the other numbered sets to avoid having to repeat for each, whilst they can still be set individually where required.
Scenario 3: Numbered dots with labels and auto-caption
Source-code for the map can be seen by clicking the 'Edit' link. Some noteworthy points about the numbered-dot map example:
- The dots are given numbers when
shape = n-circle
(square, triangle and diamond also available) - Depending on use cases, and on the number and density of dots, you might choose not to set some (or any) labels, relying on captions/links/main text to explain which feature is which.
- To avoid over-writing, a label position can be adjusted in relation to its dot using ldx and ldy parameters to set + or - pixel offsets horizontally and vertically. (Down and right are +ve, up and left -ve).
- To avoid a crowded area of the map, shape4 uses
| label-pos4 = top,with-line | ldx4 = 8 | ldy4 = -37
to move the label much further away, and add a line linking the label to its shape. - Line breaks can be added to any label by adding a ^ symbol wherever needed, to split a long label.
- By setting
auto-caption=1
, numbered shapes are all listed within the caption, using the 'mark-title' values, which as with shape2 here, might include links or explanations of multiple different items. - Instead of a 1, which gives a full-width caption area, this example sets
auto-caption = 14
which requests a column width of at least 14 ems. The template then adds as many columns as that width permits. - By default, each dot will be given the same number as its 'mark-number'. If each dot is used in turn the numbers will go in sequence, and will match the numbers on the fullscreen version. Fullscreen numbers always run in sequence from 1 upwards, so if you don't use some mark-numbers, or over-ride them with 'numbered=', the fullscreen dots won't match. But they are self-documenting via their hover/click links, so that is not a problematic outcome, if that is desired.
{{Flushing Meadows-Corona Park map}} is a useful real life example in template form.
Inherited values
Each mark and label can be given a unique set of attributes (size, colour, outline, angle, relative position, etc.) To minimise repetition of code, there is a sliding scale of inheritance that applies to each value in each parameter set. For example, if label-size4=16
is set, that will always take precedence. If label-size4 has not been set, it will inherit the value from the special Default setting (defined using label-sizeD=
). If no Default has been set, it will inherit the value set by the 'master parameter set', label-size1=
. If that is also undefined it will fall back to the underlying default, which in the case of label-size is 13. The same is true of all the variables relating to marks and labels, (although not to the coordinates, labels themselves, or mark-titles, which are always unique to the particular mark they relate to.)
Scenario 4: Using marks to add graphical elements to the map
Noteworthy Points illustrated by the map of Banwen area:
- Each of these marks has a very different appearance, and some are sized to be 'map features' rather than markers.
- Mark-size can be used not just to set width, but also height, by adding a second, comma-separated value. This allows a 'box' to be given a rectangular shape. In the case of 'box' a third value sets a radius for the corners, which gives the rounded corners of the two Roman forts. eg
| mark-size2 = 44,62,4
- The Marching fort has a transparent colour, so only the outline shows up, set to give a wide, dashed outline.
- Label-pos2 is set to 'center', so the words appear within the shape, rather than alongside it.
- There are now various ways to add a line to the map. The Roman road on this map is included by using
shape6=rule
. A rule has 'shape-outline' attributes, which are all set by| shape-outline6=hard grey,2,60,dashed
color and line-width are required. Opacity% and 'style' are optional. The style options are solid, dashed, dotted or double. - If you look at the fullscreen version, you will only see the first three marks. An item can be excluded by setting
mark-title6=none
, for example. - All three of the fullscreen marks here show as white, but for different reasons. Mark-color1 is set to white. Mark-color3 is not defined, (Red pog.svg, being an image item, brings its own color), so the fullscreen dot 'inherits' white from Mark1. Mark-color2 is set to transparent, which shows as white for the fullscreen dot. Adding more diverse items to the map can affect the fullscreen colors, intended or otherwise.
- This map also shows the county boundary. See the Parameters Section for details of how Qvalues can be used to show 'map-data' lines from OpenStreetMap.
- 'curveA', an arrow-curve has been added to this (contrived) example. curveC (clockwise version) is also available.
Adding a Minimap in the left or right corner
Many pages with info-boxes already include a locator map showing where the topic or place is located. For those that don't it might be helpful to include one within your map. It is possible to incorporate an existing 'Location map' (from Wikimedia Commons) in a corner of this map.
The width and height of the Location map both have to be decided upon, specified (and calculated so as to not shift the map away from the corner). Some location maps may already highlight the feature, but if not, an optional locator 'pog' can be placed by calculating and specifying the minipog-gx and -gy values, using a 100x100 grid across the minimap. (so gx and gy values of 25 and 50 would place a dot a quarter of the way across and half way down the minimap. It does not pick up or use latitude and longitude values. The origin (0,0) is in the top left of the minimap and the map itself defaults to the bottom right corner, but can also use minimap=file bottom left
, minimap=file top left
and minimap=file top right
.
The dot will remain in the right place even if you alter minimap size. (Note, the now redundant minipog-x and minipog-y are retained for compatibility. These used the same pixel dimensions as the width and height of the map, which made them harder to calculate/guess and needed to be re-done if the size was changed. Much better to use gx and gy from here on.)
If the area of the actual map is a large portion of the mini-map, an open red box can be included instead of a dot, to show the bounds of the main map. To use this feature, simply specify the width of the required box: minimap-boxwidth=xx
where xx = the percentage of the minimap width for the box. In general anything much below xx=15 will be better served by a dot. The box will be centered at the coordinates minipog-gx and minipog-gy. The required width will require some trial and error to pin down. The box height is then matched in proportion to the actual map and will scale if the minimap size changes.
Text on an arc
Text for broader geographic features can be placed around an arc, to convey a sense of a broader area, or to follow the curve of a river, mountain range, coastline, etc. This works entirely separately from the other labels. It does not attach itself to any mark or dot, and does not create any fullscreen markers. It requires coordinates for the first letter, parameters for the starting angle, radius of arc and gap between letters. Text size and color can also be specified, or inherited from Default settings.
References
- ^ Royal Commission on the Ancient and Historical Monuments of Wales (1976). Glamorgan Inventory, Vol 1, Part 2: The Iron Age and Roman Occupation. p. 100.
Alternative marks
Instead of using the standard 'Red pog' for mark points on the map, other images can be used. Any image from Wikimedia Commons can be specified. The Pentre Ifan example above uses 'Archaeological site icon (red).svg'. If a particular image file is specified in mark1=
, all subsequent marks will use it as well unless they name their own image file. If the image is not square, a dimension value also needs to be set (width ratio for a height of 1)
Transparent overlay
A marker image does not have to be small and opaque. A larger overlay image (with a transparent background) can be used to show particular features not included in the base map, such as a town's former walls (see the adjacent map, whic is using [[File:Leicester Town Walls map overlay.svg]] ). Such images can be created in several ways (such as tracing over a copy of the base map); they are invoked like any other marker image file. (For a detailed guide to creating and deploying an overlay for these maps see User:J. Johnson/OSM overlay how-to). (See below more direct ways to show linear graphics.)
Legend/Key/Information panel within the map
This is a new (for 2024) feature, using shape=panel
. It uses the normal coordinate system to place both the top-left corner of the panel, and any marks/explanations that are placed over them (even though they have no real relationship with that point on the map).
With no numbers or labels, the use-case here is showing the scatter of different types of sites. The individual dots can still be 'interrogated' for further information, particularly using the fullscreen version, but only if 'looked for' rather than presented up-front. Different page content will have different needs. A map should aim to show the most relevant information, and editors can make choices on how to best make the map a part of the article's narrative.
(A note on order of drawing: The un-numbered mark is drawn first. Numbered marks are drawn starting with 60 and drawing shape1 last, which is therefore 'on top'. The overlay uses the un-numbered mark, to go below everything else. The panel in this example uses the shape20 set to place it underneath the two legend marks (16 and 17) so that they show on top of it.)
Text color
Color of label text can be specified using label-color =
. Standard html colors can be specified by name, and any color can be specified using the hex triplets coding #xxyyzz (see Web colors). However, to create a consistent look and feel across the wikipedia maps, there are some OSM Location map specific colors, with a more muted tone range that fit well with the color scheme of the base maps. In general it is best to make use of this range, unless there are good reasons for using other particular shades for specific features.
Under normal usage, the following label color scheme should be followed:-
soft grey | Settlements = soft grey (Subject of the map can be hard grey and larger label-size)
Map areas with darker or busier backgrounds may need to move a shade darker to hard grey and dark gray respectively. |
soft blue | Rivers, lakes, sea areas etc = soft blue (Works well on top of OSM blue areas) |
soft green | Parkland, national/regional parks, gardens, forests etc = soft green works well on top of OSM green areas. (hard green may be desirable in forests or for the subject of the map) |
hard red | Use with care = dark red goes nicely with a red pog but can look like a redlink. Alas, no wikilinks possible on the map as yet.) |
dark grey | Individual sites = dark grey (no need to specify if the site has a single label to accompany a red pog) |
dark brown | Information panel = dark brown (works nicely on a 'pale brown' panel, for example) |
Full table of color options
Colors recommended for OSM Maps.
These have a more pastel shade than the standard colors, so blend well the map backgrounds (pale varients are only for panel-backgrounds, etc) | |||
---|---|---|---|
pale red #FCC6C0 | soft red #DB3123 | hard red #AA1205 | dark red #7A0101 |
pele green #D2F0E5 | soft green #81AF81 | hard green #538253 | dark green #165916 |
pale blue #D6E1EC | soft blue #77A1CB | hard blue #5581A9 | dark blue #5581A9 |
pale grey #E8E8D6 | soft grey #AAAA88 | hard grey #777755 | dark grey #333322 |
pale brown #FAF6ED | soft brown #CCB56C | hard brown #AD7F14 | dark brown #8E5913 |
Standard html colors.
These tend to look rather harsh on the OSM maps but are retained for compatibility | |||
White #FFFFFF | Silver #C0C0C0 | Gray #808080 | Red #FF0000 |
Maroon #800000 | Yellow #FFFF00 | Olive #808000 | Lime #00FF00 |
Green #008000 | Aqua #00FFFF | Teal #008080 | Blue #0000FF |
Navy #000080 | Fuchsia #FF00FF | Purple #800080 | Black #000000 |
Orange #FFA500 | transparent #FFFFFF00 | background1 #F9F5E7 |
New to 2024: All colors can have an opacity value as well as the color name. eg label-color3=dark blue,30
will set a 30% opacity. (The '50%' and 'opacity' parameters are now deprecated. ie they still work, but are not needed anymore)
It is also possible to specify any HTML Hex color using the six-figure hex-code, eg #AAAAAA, but sticking to defaults allows a consistency between pages
If no valid color is specified the color will be set to a default of 'hard grey'
Text, shape and outline opacity
With the 2024 changes it is now possible to easily set the opacity value of any specified color. For 'label-color' and 'shape-color', this is a second, comma-separated value. For 'shape-outline' it is the third item, (it takes color name,line-width,opacity,style). eg shape-outline4=hard red,8,30,solid
would add a transparent red outline 8px thick around the shape. (Note, the opacity is given as a %. For historical reasons, an opacity of 0 and 100 both give fully opaque colours. To set as entirely transparent, use a value of 1 - or the colour name 'transparent'.)
- Alternatively:
| label-color=#1659165A
. It is possible to set an opacity value when using #hexvalues instead of just named colours from the HTML color-space. The opacity is an additional two-digit hex value to make an 8 digit #value, with the opacity digits ranging from 00 (opaque) to FF (transparent).
There was previously an option to specify 'Halo' features around shapes. These were rarely used (it at all) and would have made considerable resource demands through the use of multiple additional shapes. With the template size risking difficulties when many dots are used, the halo parameter has been removed for now. Various halo-like effects can be obtained using the shape-outline option.
Text effects
- multi-line label
- Where label text is too long to fit on a single line, using
label =
, any line can now be split as many times as desired using the ^ hat symbol. This supersedes the now deprecatedlabela =
andlabelb =
. To put an actual ^ in your label, use the^
entity.
- Label with no mark
- If
mark-size=0
this has the effect of a free-floating label with no marker
- Angled label
- It is possible to specify a
label-angle =
, which will pivot the label text around the centre of the marker point by the specified angle. Using an angled label which also has no marker is particularly good for labelling various geographic and linear features. A more characterful alternative is to set the text on an arc, using the ArcText options. For stylistic consistency settlement and building names should not normally be given an angle.
- Wiki markup
- New to 2024, all text is shown as standard wiki text. This means you can use '''bold''' and ''italic'' as normal. Wikilinks are also possible, but note that they will then take standard wikilink colors, including red-link for non-existent links.
- And one for the geeks: if you are desperate to use other fonts or font-effects, you can include elements such as <span style="...">your text here</span> as part of your label. But use with caution and care. the aim is not to overwhelm the map with fancy effects. However, used appropriately it could be just the solution you are looking for - provided you know enough html/css/etc.
Use in infoboxes
{{OSM Location map}} can be shown in many infoboxes. This may depend upon if they allow a map_image
parameter (preferable) or the module
and/or embedded
parameters, as their image
parameter is usually used and best reserved for images. See for instance {{infobox school}} by using the instruction |module={{OSM Location map| ...}}
. For an example, see St John Fisher Catholic School which uses the map to show its two sites within an infobox map. Some infoboxes also allow it to be incorporated within the caption below an image. However, this only works if an image and some caption text are also present. (see Inishmore Lighthouse). A dual use template with controlling logic is possible as with {{Karakoram OSM}} and its different display in K2 using {{infobox mountain}}.
Using label text to draw graphic features
With the arrival of various outline and line-drawing features, there is less need to resort to text labels as a way of showing simple graphics. However, for certain cases, some of the many unicode items in the Box Drawing list may be of use.
List of parameters
Code blank - OSM Location map template, listing all the parameters |
---|
{{OSM Location map
| coord = {{coord| | }}
| zoom=
| float =
| width =
| height =
| fullscreen-option =
| caption =
| title =
| minimap =
| mini-file =
| mini-width =
| mini-height =
| minipog-gx =
| minipog-gy =
| minipog-boxwidth =
| scalemark =
<!-- optional default settings. These 'D' parameters only create override values for subsequent marks. They make no marks of their own -->
| shapeD =
| shape-colorD =
| shape-outlineD =
| shape-angleD =
| markD =
| mark-sizeD =
| mark-dimD =
| label-sizeD =
| label-colorD =
| label-angleD =
| label-posD =
| ldxD = <!-- short-forms of label-offset-x and -y are now available for all sets-->
| ldyD =
<!-- unumbered parameter set creates mark and/or label on the map -->
| mark-coord = {{coord| | }}
| mark =
| shape =
| shape-color =
|shape-outline =
| shape-angle =
| mark-size =
| mark-dim =
| label =
| label-size =
| label-color =
| label-angle =
| label-pos =
| ldx =
| ldy =
| mark-title =
| mark-image =
| mark-description=
<!-- Arc text (A, B and C) no shape, mark or fullscreen effect, just text on an arc. Coords are for the first letter (max 20).-->
| arc-coordA = {{coord| | }}
| arc-textA =
| arc-angleA =
| arc-gapA =
| arc-radiusA =
| arc-text-sizeA = <!-- defaults to 12 -->
|arc-text-colorA =
|ellipse-factorA = <!-- defaults to 1.0 -->
<!-- numbered markers (1 to 60). Values set in mark1 will be inherited by all other numbered markers, unless overridden by a 'D' value-->
| mark-coord1 = {{coord| | }}
| mark1 =
| shape1 = <!--image/circle/square/triangle/diamond/rule/box/ellipse/etriangle/panel -->
| shape-color1 =
|shape-outline1 = <!--color,width,opacity,style-->
| shape-angle1 =
| mark-size1 = <!--width,height,corner-->
| mark-dim1 =
| label1 = <!--use ^ to add a newline, this makes labela1 and labelb1 redundant -->
| label-size1 = <!--includes extra parameter options: ,outline,background for text effects-->
| label-color1 =
| label-angle1 =
| label-pos1 = <!--position,[line option][,further options]
| ldx1 =
| ldy1 =
| mark-title1 =
| mark-image1 =
| mark-description1=
| mark-coord2 ={{coord| | }}
| mark2 =
| shape2 =
| shape-color2 = <!-- ... and so on for all the parameters above, for all numbers up to 60 -->
}}
|
Parameters
Map display parameters | |
---|---|
Parameter | Description |
coord
|
Latitude and longitude coordinates of the centre point of the map.
Use HINT: gridreferencefinder.com, is a helpful place to find coordinates if you have other grid references. In Preview mode, a right-click while using the 'Interactive fullscreen map' will also show a coord point. |
zoom
|
Sets the scale of the map, from 0 to 19, to the levels defined by OpenStreetMap. (details here).
NOTE: The actual distances represented will vary depending on the latitude, as the scale defines different fractions of a degree. The apparent scale will also vary depending on the screen device, browser magnification, etc. The on-screen 'scalemark' gives a rough indication of the scale of the map. |
float
|
Positions the frame to the left, centre (or center) or right. (default is right). If centered, the text will be forced above and below, otherwise text will wrap to the side.
HINT: For left or right align, if you want to ensure some following text sits alongside the map, use {{clear}} before the map template. |
width height
|
Sets the width and height of the map in pixels. Only the number is required (i.e. no px). Default is 350 by 250 pixels. |
fullscreen-option
|
From 2024, the 'link-box' symbol at top left is hard-coded onto the map, so will always include the link to an Interactive Full screen, which also has links to other mapping options and a facility to show locations of other nearby articles. The parameter no longer has any effect. |
nolabels
|
Optionally use a map-set without settlement/country names.
By default the base map uses mapstyle='osm-intl'. Progressively higher zoom levels bring more place names onto the map, in the language/script of the wiki/user preference, where that is available. For some contexts it may be preferred to 'turn off' the place name labels, and use the mark/label options to provide such names as are wanted. Use |
caption auto-caption
|
Optionally, a text caption can be included, below the map. Unless overridden by tags etc., this is left-justified plain text. It can include any wiki-item that can be inserted into a table cell, including images, formatting, citation references, etc.
If |
title
|
Optionally a title or other text can be placed in a cell above the map. By default this is centred and bold, but as with the caption, any wiki-markup can be included. |
|
Allows 'OSM ExternalData elements' to be added to the map. This can be an administrative boundary, highway or other linear map element that has been assigned a wikidata Q value. (e.g.: map-data=Q83065 will add the city boundary of Leicester.) The map item needs to be on the same place as the map itself. It can be linear features or inverse areas (not filled areas/shapes). Multiple elements can be added, separating each Q value by a comma. New to 2024 is that the element will be on the framed map as well as in fullscreen, and can apply an inverse mask.
nominatim.openstreetmap.org/ has a search engine to identify data elements for which Q values have been assigned, or to add (or repair) wikidata Q values to map elements. The relevant wikidata page also gives its Qvalue. Some maps already have Qvalues in place option, so it seemed wise to proceed with caution in making them suddenly visible on the framed version. To this end, all such lines are for now a 10% opacity grey line, 6, 9 and 3 pixels wide for Links are still only visible in fullscreen. The framed version lines have no links, so it may be helpful to use a discrete label alongside a boundary (for example) to indicate what it is (See Banwen example, above).
|
minimap
|
Set to file to add an external locator-style map from wikimedia commons, plus optional locator dot. A map can be placed in any of the four corners. minimap=file bottom left , minimap=file bottom right , minimap=file top left .
If just |
mini-file
|
Takes the file name of a standard location map from Commons (without 'File:'), and displays it as a minimap in a corner.
mini-width and mini-height are the desired dimensions of this minimap, in pixels. Unlike pre-2024, all images are now displayed at their given proportions. The width/height ratios still need to match or the file will be above or below its corner. |
|
Within the custom minimap this can place an optional small Red pog. Nb. The x and y are not lat and lon values. They relate to a 100x100 grid of the minimap at whatever size and ratio it is set to. The origin is top,left of the mini map, so if minipog-gx=25, it will be a quarter of the way across. (Some location maps have a highlighted location already, so leaving these two parameters undefined gives the map without a dot.)
minimap-boxwidth=xx can optionally use an open red box instead of a Red pog. xx = the width of the box, in percent of the width of the minimap. The height is then matched in proportion to the actual map. The box is centered at spot corresponding to (minipog-gx,minipog-gy). In general anything much below xx=15 will be better served by a dot. The required width will need some trial and error to pin down. If xx=0 or minimap-boxwidth is undefined, a Red pog is used. |
scalemark
|
By default or with scalemark=1, a scale line with guide to the scale of the map is supplied near the bottom right corner of the map. If this is not required - e.g. if it interfers with a map element at that point - it can be turned off by setting this to '0'. To shift it further left, e.g. to avoid a minimap, or to avoid a 'busy' bit of the map, enter the number of pixels to shift left. If not set by hand it will automatically shift to the left of any bottom-right minimap. |
Label and mark parameters. | |
Sixty-one marks can be set on the map, being an un-numbered version, and the series numbered 1 to 60. The first numbered one, (mark1, label1, etc.) is a 'master marker' and its values are inherited by the other numbered markers unless set individually. (nb: label1= and mark-title1 etc are not inherited). All label, mark and full-screen parameters are available for each numbered marker. For added flexibility a parameter set with a 'D' value instead of a number will override the master values with a more general Default. The 'cascade of inheritance' (eg for 'shape3=') runs as follows: is there a setting for shape3? if not then is 'shapeD' set? If not, then is 'shape1' set? if not then use the underlying default, which in this case would be shape=image.
Fullscreen dots numbered from 1, and will always run in sequence. Numbered dots on the framed version will match these numbers if you start with mark1 and use them all in sequence as well. | |
Parameter | Description |
shape
|
OSM Location map can use either an external image as a location marker, or one of various shapes. The mark-size setting will require different numbers of items for different types of shape.
|
shape-color shape-outline shape-angle numbered
|
*shape-color sets the shape infill to a color, and optionally opacity. eg shape-color=hard blue,60 will give a 60% opacity. (This replaces shape-opacity which is no longer needed but still works for now). As with all the opacity settings here, 0 and 100 are opaque, 1 is transparent. All the color parameters can either use the color names in the table above, or use hex triplets (e.g. #FF0000), as described at Web colors. If using hex, a further two digits can optionally set opacity. Default = dark red.
(Note - CSS limitations mean triangles and arrows cannot have outlines).
The |
mark
|
The name of a Wikimedia commons file, which is used as the marker. Default is Red pog.svg. Other pog colours are available (see Commons: Map pointers, dotset 1), and a large range of map markers can be found at Commons:Location markers and Commons:Category:Map icons. Nb, at present if a default shape-outline is set, this appears around images as well. Use shape-outline=tranparent to remove it. |
mark-size ( mark-dim )
|
Size and dimensions of a marker. mark-size is used by both shape and mark and can define the width, height and (where relevant) corner radius of the marker symbol. A single value sets the both the width and height of the mark or shape in pixels (no 'px' required, default is 12). A second, comma-separated value will set height, and a third will be used by box or panel to define the corner-radius. If only a text label is wanted with no marker, set mark-size=0 .
NOTE: Of particular use with n-circles and n-square, the text-size for the number is based on the shape's 'height' value. If only one value is supplied, that is both width and height. By supplying a second value, (eg: mark-size=13,11) the text-size of the numbers can be adjusted in relation to the size of the shape. |
mark-coord
|
Latitude and longitude coordinates of the marker point. Use the format mark-coord={{Coord|lat value|lon value}} . Used by shape and mark as well as the related label . If the location is outside the area of the map, it will not appear. (for backwards compatibility mark-lat and mark-lon still work, but are not the preferred method.)
|
label
|
Text to appear alongside a mark or shape. If left blank then a mark will show without a label. If only a text label is wanted with no marker, set mark-size=0 If there is no label and a mark-size=0 this is an invisible marker, but will still feature on the Fullscreen option.
New for 2024: Where label text is too long to fit on a single line, using Text that strays too close to the right edge of the frame may now 'automatically wrap' to the next line. However this will not be 'balanced' in the way the inserted linebreaks are, so in most instance manually breaking u the line will be preferable. All label text is now standard wiki text. This means you can use '''bold''' and ''italic'' or even your own <span...</span> items, if you really need to. Wikilinks are also possible, and the label will become a live link, but note that they will then take standard wikilink colors, including red-link for non-existent links. |
label-size
|
Sets the text size for the label, in points. default = 12
New for 2024, label-size can have additions to place a background fill and/or an outline around a label. text-size=12,background will use the standard background map-color as a solid fill under the area of the text - handy if the label is being confused by other map details. Adding 'outline' will place a 1px wide black line around the text to make it more noticeable - although it will not cope well with any line breaks. They can be used separately or in combination: eg Two further colours can be used for the fill: If 'paleground' or 'beigeground' is used instead of 'background' it will give a fill that is respectively paler or darker. |
label-color
|
Sets the text colour for the label. The standard colour labels (red, black, grey, white, blue, green etc...) all work as described, but can be rather strident on the OSM map. Each of the colors below have three standard shades - soft, hard and dark. Default=dark grey. (Actually defaults to #222211, slightly darker than 'dark grey', so it is prominent when someone just puts a single pog and label. A comma-separated number after the color will set the opacity (%). eg dark-blue,40 will give 40% opacity.
Under normal usage, the following label color scheme should be followed:-
It is also possible to specify any HTML Hex color using the six-figure hex-code, eg #AAAAAA, but sticking to defaults maintains consistency between pages. If no color is specified the text will have a default of 'dark grey'. (nb: Any value other than one of the named colors above or a hex code will return as 'dark grey') |
label-pos ldx (or label-offset-x )ldy (or label-offset-y )(in pixels, - = up and left, + = down and right) |
At its simplest, label-pos sets the position of the label, relative to the marker: left, right, top bottom or centre/center. Default=left. Top, bottom and center text is center-justified, whereas left and right align against the marker. The label aims to be an appropriate distance from the edge of the marker, but irregular shapes and larger sizes may need further adjustment using the label-offsets - now in a shortened form of ldx and ldy. These 'offset' values can also move the label much further distances, and make use of the line-drawing additions shown below.
Center (or centre) text is placed over the middle of any shape, point, rule, box or panel. Line breaks will 'spread' the lines above and below the center-point. Nb: in the case where the shape is a panel, the text is placed 'within' rather than to the side of the shape, and left and right become 'justified' instructions for text that will wrap within the panel, rather than the 'positional' instruction it normally is. NEW for 2024: Further line-drawing options are now available, by adding additional values to this parameter, each of which will work with any of the above position indicators.
|
label-angle
|
It is possible to specify a label-angle = , which will pivot the label text around the centre of the marker point by the specified number of degrees. (+ve angle rotates clockwise, -ve anticlockwise) If mark-size is set to zero, this has the effect of a free-floating label with no marker, useful for various geographic and linear features. For stylistic consistency all settlement names should not be given an angle.
|
Additional content for Full screen link | |
The 'full screen' map uses the same OSM base map, in a different map environment, including the option for users to scale in and out, to pan across the map, and to find (via the 'More details' button) other maps and satellite imagery for the location. It also includes numbered markers, for which tooltip-style titles, and image thumbnails with captions can be brought up. This makes most sense where there are several markers on the map. The content for this facility is set with the following three parameters - which need to be numbered for each mark as for the other mark attibutes: | |
Parameter | Description |
mark-title
|
This title appears as a tooltip and also a thumbnail title, accessed by clicking the marker. if mark-title=none that will exclude that marker from the full screen map. (it will still show as normal on the main map).New for 2024, if a wikilink item is included within mark-title, it will now make the mark a live-link on the framed map. Only the first link is used as a link, but the whole text is shown as a tooltip, when hovering over the mark/dot. |
mark-image
|
This provides a pop-up thumbnail image when the marker is clicked. Include only the image name from Wikimedia commons etc. (i.e. no brackets, or 'File:'). |
mark-description
|
Caption text, which will either accompany a pop-up photo, or if no photo then as a text box, when the marker is clicked. This can include wikilinks etc., to link on to additional relevant articles. |
Arc Text: label placed on an arc | |
Arc-text parameters allow up to 3 digfferent short texts (up to 20 characters) to be placed along on arc, with parameters to control the tightness of the circle (radius) and the looseness of the text (gap). Changes in radius will also have an effect on the gap size, with a larger radius opening out the gap. Trial and correction will be needed to get the shape and effect desired. As a general rule, identify the coordinates of the required start-point, then choose a starter-pattern from the selection at OSM Location map#Text on an arc, and then adjust parameters to fit the requirement of the map. The parameters below are for set A. Sets B and C are also available. | |
Parameter | Description |
arc-coordA |
coordinates of first letter, using ={{coord|xxx.xx|yyy.yy}} |
arc-textA= |
Add your text here |
arc-angleA |
in degrees, -180 to 180. 0 will start as horizontal, -90 straight up, 90 straight down |
arc-gapA |
1= a notional 'standard'. 0.2 is very tight, 10 is very wide. Applying a negative gap will invert the letters and run the other way around the circle |
arc-radiusA |
1= a notional 'standard' 0.5 is quite a tight circle, 8 is so wide as to be almost flat |
arc-text-colorA |
sets text color. #000000 color hexes and standardised OSM Location map colors are accepted |
ellipse-factorA |
will squash or stretch the circle. 1= notionally circular, 0.5 to 1.0 will flattern top and bottom, above 1.0 flattens the sides. |
Comparison with {{Maplink}}
Since May 2018 it has also been possible to create a map in a frame via {{Maplink}}, which in some respects does a similar job to OSM Location map. In both cases a static map image can be added to an article, for anywhere in the world, pulling in the map from OpenStreetMap data. The differences are in what they can and can't add to the base map. Maplink, in both its framed and fullscreen versions, can add points (numbered or icon-style pointy dots), and various, lines and areas generally imported from OpenStreetMap via wikidata Q values. A large part of its role is in providing an 'automated' map, using wikidata to give quick results, often within an infobox. With OSM Location map the process is much more hand-built, drawing together elements from the article. The framed map can show a much richer selection of dots, shapes, graphics, overlays, images and especially text to convey specific details relevant to a particular article. It has now also been enabled to show Q value (at present limited to boundaries, and roads). The fullscreen equivalent is much closer to a Maplink fullscreen item, re-using as point-items the details supplied for the framed map.
Underlying technology
OSM Location map itself has no map or display ability of its own. Until 2023 everything within the frame was produced through the template {{Graph:Street map with marks}}, created by User:Yurik. It made use of the Vega visualisation package which displayed both the base map and a range of text and graphic features. In its original incarnation the result was a rendered bitmap image, making the viewing overhead very low compared to editing, but with a low-resolution output. In 2020, the bitmap creation process was withdrawn, resulting in a much clearer page view, but adding considerably to the resource overhead.
In April 2023 the Vega package was withdrawn, along with all of its 'graph' dependencies, amid security concerns. After a protracted period of uncertainty (still unresolved as of April 2024) a way was found to replicate the outcomes previously handled by 'graph'. By making use of Extension:Kartographer, through its <mapframe> tag, the base map could be displayed within an HTML <div> element. Inline CSS coding could then be used to show the graphics and text within the resulting frame. The Mercator 'coords' are converted to (x, y) pixel values to match the map location and zoom level. This switch not only got the existing stock of 5,600 templates back in a working state, but also allowed the implementation of additional graphical items, as well as gaining a more standard use of wikimarkup and wikilinks.
The full screen option, which can be clicked through from the framed map, provides an entirely different mapping approach, although also using Kartographer to access the OSM base-map data. This uses <maplink> to provide a fullscreen interactive map that can be panned and zoomed. It also replicates (as numbered markers) the various marks and colors from the framed map. These can then be given extra content, by way of a title, image and description, along with displaying the coordinate values. The result is a map-based page that offers another way of engaging with the article content.
Further development of mapping technology is currently not a Wikimedia Foundation priority area. Having established {{maplink}}, which initially just created a text link to a full-screen map, to the point where it provides a framed image with data directly from wikidata, there are no active developments for different mapping solutions. (Please tell us if you know differently!). The processor overheads are reduced by showing a static image in the frame, which can be clicked to become interactive in fullscreen. Maplink is now effectively rolled out within info-boxes, where the map is automatically generated from already available data.
This template is geared rather to producing a hand-editable map, in which the area displayed and the selection of items and labels included are selected, edited, and added to, to suit the specifics of the subject in hand. A further approach, which is not currently supported by any mapping template, is to draw the data from external live data, such as using a SPARQL query, to generate, for example large-area scatter-plots to show different distributions across a map. The security and maintainability aspects of such tasks, as with other graph visualisations of live data, are a major barrier to implementation.
The technology used here (Kartographer plus inline-css) is probably best described as 'reasonably well developed'. As of late April 2024 it would seem to be in a stable and sustainable state, so should not see the kind of hiatus experienced by 'Graph' in 2023. It is highly likely that this or a comparable solution will still be available into the future. Of the possible evolutions over time one may be through SVG-based graphics, allowing a richer graphical content and maybe even moving towards a proper visually-based editing environment. In the opposite direction, there is a demand for maps that can show more dots with less resource impact, perhaps by paring back on the feature set. But these should most likely be seen as alternatives rather than replacements for this template.
See also
- Wikipedia:Maps for Wikipedia - A list of mapping tools available on Wikipedia
- {{Location map}} - Placing one marker/label by latitude/longitude.
- {{Location map+}} - Placing unlimited list of markers/labels.
- {{Location map many}} - For displaying multiple marks using latitude and longitude.
- Commons:Category:Map pointers - List of the many Wikimedia Commons pointer symbols.
- {{Overlay}} - Allows image numbered, textual number, or color tag overlays to be positioned over an image to indicate particular features in the image.