Jump to content

Template:OSM Location map/doc

From Wikipedia, the free encyclopedia

Technical issue

[edit]
AS OF 18TH APRIL 2023 A TECHNICAL ISSUE HAS RESULTED IN WIKIMEDIA TEMPORARILY DISABLING THE 'GRAPH' MODULE ON WHICH THESE MAPS DEPEND.
Work is hopefully ongoing to resolve the issue, and there is hope that a solution will be found eventually. In the meantime we apologise that the 'on-page' maps are not available.

This Beta page provides a development environment to produce trial maps. It can also be used to create static maps by creating a map on a page, saving the image to file, uploading it to commons and adding it to real wikipedia pages. If this is something you are willing to have a go at, please list any such source and destination maps in the Beta [[OSM Location map/talk]] discussion section, so they are able to be identified, should anybody need to.

Note: The 'interactive fullscreen map' links to a different mapping system, which is still available on en:wikipedia, but does not work properly on this Beta site. Unfortunately that link is lost with a static image at present. Hopefully one day it can all be got back on track.

Documentation

[edit]

This template provides a map for any location and scale. The OpenStreetMap image and a scale indicator provide a base on which markers, text labels, numbered dots, shapes and lines, a mini-locator map and photo-panels can provide detail and context for the map. An 'Interactive fullscreen' version allows the for zoom and scroll with selected marker-points and an option to show nearby wikipedia pages.

Purpose

[edit]
  • A map in a frame for anywhere in the world, at any scale from the whole world down to one or two streets.
  • Uses OpenStreetMap mapping data, so a place-based page or topic can show the area being described without external graphics.
  • The underlying map will be updated as the OSM data develops.
  • A zoom level appropriate to the topic can be selected.

The map can also show multiple images, shapes, lines and labels (currently limited to 60). The resulting framed map also has a link to an interactive full-screen version, (via <maplink>) which shows the same location 'over the top' of the current page. This is not able to show text or images, instead it uses pointer marksand allows the user to zoom and pan. It can be supplied with popup thumbnail images and captions on the marker points, an option to show other nearby wikipedia pages, and links to access a wide range of other maps, satellite images etc.

Comparison with {{Maplink}}

[edit]

From May 2018 a map in a frame via {{Maplink}} has offered a similar provision to OSM Location map, pulling in a selected base-map from OpenStreetMap data. Maplink, in both its framed and fullscreen versions, can add either points (numbered or icon-style pointy dots), and various boundary lines and areas can be added via wikidata Q values. The OSM Location map on the other hand, cannot add the Q value lines/areas (except via the interactive fullscreen click-through). On the other hand it can show a rich selection of dots, shapes, lines, overlays, images and especially text to convey specific details relevant to a particular article.

Usage

[edit]
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}}  <!--lat/lon coordinates for map's center -->
| width=300| height=150              <!--decide how big a box you need-->
| zoom = 15                          <!--zoom 0=whole world, 18=a street.-->
}}

Single marker

[edit]

By using mostly default settings a map with a 'Red pog' marker and dark red label can be produced. The example below also adds some additional items (the last three parameters) that are used by the Interactive fullscreen version.

The 'Llanfechell Triangle' standing stones are north-west of Llanfechell.
{{OSM Location map
|   coord = {{coord|53.394|-4.450}} | zoom = 13
|   width = 300 | height = 150
| caption = The 'Llanfechell Triangle' standing stones are north-west of [[Llanfechell]].

| mark-coord = {{coord|53.3966|-4.46204}}  <!--coords for red mark -->
|      label = Llanfechell Triangle        <!--text displayed next to red mark -->
|  label-pos = right
| mark-title = Llanfechell Triangle        <!--text shown in fullscreen map when hovering over or clicking on marker -->
| mark-image = The Llanfechell Triangle - geograph.org.uk - 1260817.jpg  <!--image & text for fullscreen mode when clicking on marker -->
| mark-description=Group of standing stones thought to date to the Bronze Age, at [[Llanfechell]], [[Anglesey]] 
}}
Code blank
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 -->
| 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

[edit]

In addition to the set of un-numbered mark/label parameters, there are 60 numbered sets. These are otherwise identical to the one above, add a number (1-60) to each parameter. Each mark/label has a full set of parameters (|mark1=, |mark-coord1=, |label1=, |label-pos1= etc...|mark2=, |mark-coord2=, |label2=, |label-pos2= etc.) Using these it is possible to set the position, dimensions, and appearance of a wide range of shapes and marks, as well assigning a text label, setting where and how it relates to it's mark.

The 2023 implementation of Vega5 as the underlying graphical engine has allowed for a substantial expansion to the range of shapes. These can be summarised as follows:-

  • Text: Every shape can be assigned a text label if desired. It will be shown either to left, right, top or bottom of the shape. New to 2023, newlines can be easily added by use of the ^ character. (Do not add actual line breaks within text - this will not end well).
  • Built in shapes: These all have a 1:1 dimension. Size is set using |mark-size=. New to 2023, |shape-angle= can turn these and other shapes by any chosen angle in degrees. Set using |shape=, these include circle, square, triangle, cross, arrow, wedge and stroke.
  • Image: When [shape=image] (or is left unset), the value of |mark= should be the name of a commons image file. |mark-size= sets the height,width of the chosen image. (or use |mark-dim= to set the width ratio). If mark is undefined, the default [Red pog.svg] will be displayed.
  • Library of svg shapes. These are similar to the built in shapes, but there are sub-varients set using |mark=. Also, height and width can be given different values, so |mark-size= can include height,width values. eg [para|shape=box| mark=rounded1| mark-size=12, 50] will create a box that is H10 x W50 pixels (a single number will give equal dimensions). Other shapes in the library, many of which have numerous variants) include [star, ring, ellipse, triad, line]. New svg shapes may be added to the library if need arises.
  • Panel: shape=panel gives a panel suitable for showing text. When drawing a panel, you can set its height and width, along with a third number, which sets the corner rounding. eg mark-size=180, 60, 2 would make a large panel with slightly rounded corners. Any text specified in |label=will then be placed inside the panel (rather than alongside the shape, as happens with other shapes), and will treat label-pos as justifying the text either left, right, top, bottom or center. Use ^line breaks to fill the text down the panel.


Multiple markers

[edit]

Example title
Scheduled monuments around Llanfechell, Anglesey
Example code for the two-marker map shown on the right:
{{OSM Location map
|   coord = {{coord|53.395|-4.452}}
|    zoom = 14
|   float = right
|   width = 300
|  height = 250
| caption = Scheduled monuments around [[Llanfechell]], [[Anglesey]]
|   title = Example title

|    minimap = file bottom right <!-- Adds a 'minimap image' to the designated corner -->
|  mini-file = Wales relief location map.jpg
| mini-width = 70  <!-- The desired size of the minimap, in pixels -->
|mini-height = 90  <!-- The ratio mini-width/mini-height must equal the ratio width/height of mini-file -->
|  minipog-gx = 36 <!-- Values between 0 and 100, specifying an optional red marker's location in the minimap. -->
|  minipog-gy = 3  <!-- Upper left is (0,0), lower right is (100,100). -->

<!-- first marker details -->
|      label1 = Baron Hill Maen Hir 
| mark-coord1 = {{coord|53.3964|-4.4531}}
|       mark1 = Red pog.svg <!-- Red pog is the default so not really needed -->
|  label-pos1 = right       <!-- Various settings in mark1 are inherited by the other marks -->
| label-size1 = 11          <!-- unless they are over-ridden individually -->
| label-color1 = hard grey  <!-- some standard colors can be used that blend well with the map -->
|  mark-title1 = Baron Hill Maen Hir  <!-- Text shown when hovering over or clicking on marker in fullscreen map -->
|  mark-image1 = Standing stone east of Llanfechell - geograph.org.uk - 1254434.jpg <!-- Image shown when clicking on marker in fullscreen map -->
|mark-description1=Baron Hill Maen Hir, is a prehistoric standing stone north of [[Llanfechell]].  <!-- Text shown when clicking on marker in fullscreen map -->

<!-- second marker details -->
|      label2 = Llanfechell Triangle <!-- second marker details -->
| mark-coord2 = {{coord|53.3966|-4.46204}}
|  label-pos2 = right, photo-panel,59, 150 <!-- add a photo-panel. Uses mark-image. set photo-width and panel-width. It puts a line to the marker -->
| label-offset-x2= 100      <!-- Label offsets move the label and in this case, the photo-panel (in pixel units) -->
| label-offset-y2= -60      <!-- without affecting the marker position. Can be positive or negative (short from option of ldx and ldy) -->   
| mark-title2 = Llanfechell Triangle
| mark-image2 = The Llanfechell Triangle - geograph.org.uk - 1260817.jpg
|mark-description2=Group of three prehistoric standing stones thought to date to the Bronze Age, at [[Llanfechell]], [[Anglesey]]
}}

Inherited values

[edit]

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

Adding a Minimap in the left or right corner

[edit]

Many pages with info-boxes already include a locator map to give readers a proper sense of where the topic or place is located within a broader area. For those that don't it might be helpful to include one within your map. The underling 'Graph' module that OSM Location map uses offers a built-in map of the world option, which will act as a mini locator map and automatically adds a red locator dot (minimap = on). Unfortunately it is too general for most purposes, so an alternative, but rather less automated, option is to make use of an existing 'Location map' file. This can be seen in the Llanfechell map example.

The width and height of the Location map both have to be decided upon, specified (and calculated so as to not distort the map dimensions). 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.

| minimap = file bottom right
| mini-file = Wales relief location map.jpg
| mini-width = 70
| mini-height = 90
| minipog-gx = 36
| minipog-gy = 5

The dot will remain in the right place even if you subsequently choose a different size for the minimap. (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, so as 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-x and minipog-y. 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

[edit]

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.

Blank starter-code for text on an arcs, with starter-examples for different arc-patterns.
|       arc-coordA = {{coord|xxx|yyyy}}   <!-- coordinates of first letter -->
|      arc-textA =  <!-- Add your text here -->
| arc-text-sizeA = <!-- standard font sizes. If undefined, default is 12 -->
|arc-text-colorA = <!-- sets text color. #000000 color hexes and standardised OSM Location map colors are accepted -->
|     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--> 
|                  <!-- 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 -->
|ellipse-factorA = <!-- 1.0 is notionally circular, 0.5 to 1.0 will flattern top and bottom, above 1.0 flattens the sides -->
Details about using artc-text, with starter-examples for different arc-patterns.
The nature of the earth's coordinate system means that there will be some variation in an arc at different latitudes and at different zoom levels. The program makes corrections for this, but there will still be residual variation. Similarly, changes in radius will also have some effect on the gap size, with a larger radius opening out the gap somewhat. There will therefore need to be considerable trial and correction 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 below, and then adjust parameters to fit the requirement of the map.
Shallow smile:
|     arc-coordA = {{coord| | }}
|      arc-textA =  
| arc-text-sizeA = <!-- default is 12 -->
|arc-text-colorA = <!-- default is dark grey-->
|     arc-angleA = -170
|       arc-gapA = -1.2
|    arc-radiusA = 1.6
Deeper smile:
|     arc-coordA = {{coord| | }}
|      arc-textA =  
| arc-text-sizeA = <!-- default is 12 -->
|arc-text-colorA = <!-- default is dark grey-->
|     arc-angleA = -150
|       arc-gapA = -3
|    arc-radiusA = 0.7
wide eyebrow:
|     arc-coordA = {{coord| | }}
|      arc-textA =  
| arc-text-sizeA = <!-- default is 12 -->
|arc-text-colorA = <!-- default is dark grey-->
|     arc-angleA = -20
|       arc-gapA = 3
|    arc-radiusA = 0.8
opening bracket (reading up):
|     arc-coordA = {{coord| | }}
|      arc-textA =  
| arc-text-sizeA = <!-- default is 12 -->
|arc-text-colorA = <!-- default is dark grey-->
|     arc-angleA = -110
|       arc-gapA = 1.5
|    arc-radiusA = 0.6
opening bracket (reading down):
|     arc-coordA = {{coord| | }}
|      arc-textA =  
| arc-text-sizeA = <!-- default is 12 -->
|arc-text-colorA = <!-- default is dark grey-->
|     arc-angleA = -60
|       arc-gapA = -2
|    arc-radiusA = 0.5
closing bracket (reading up):
|     arc-coordA = {{coord| | }}
|      arc-textA =  
| arc-text-sizeA = <!-- default is 12 -->
|arc-text-colorA = <!-- default is dark grey-->
|     arc-angleA = 120
|       arc-gapA = -1.5
|    arc-radiusA = 0.8
closing bracket (reading down):
|     arc-coordA = {{coord| | }}
|      arc-textA =  
| arc-text-sizeA = <!-- default is 12 -->
|arc-text-colorA = <!-- default is dark grey-->
|     arc-angleA = 60
|       arc-gapA = 2.5
|    arc-radiusA = 0.4

Multi marker example

[edit]

Pentre Ifan and other nearby Neolithic sites

Alternative marks

[edit]

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

[edit]
Leicester Castle and the line of the medieval town walls

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). 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 for a way to acheive linear graphics such as this using text labels and Box Drawing Characters.)

Add a compass rose

[edit]

If a compass rose is deemed to be helpful, particularly if one or more compass directions are described (eg 'South Gate', 'West Bridge' etc), a circe showing the points of the compass can be added above the scalemark. Add ',with-compass' to the scalemark parameter. eg: scalemark=95,with-compass

Text color

[edit]

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)

Full table of color options

[edit]
Colors recommended for OSM Maps.

These have a more pastel shade than the standard colors, so blend effectively with the map backgrounds

soft red #DB3123 hard red #AA1205 dark red #7A0101
soft green #81AF81 hard green #538253 dark green #165916
soft blue #77A1CB hard blue #5581A9 dark blue #105396
soft grey #AAAA88 hard grey #777755 dark grey #333322
soft brown #CCB56C hard brown #AD7F14 dark brown #8E5913

Also available is 'background1' (#F9F5E7), which matches the most common map background. Useful for blanking out a bit of map using '█' character, to make a plainer background for putting a second label over the top. (This can be tricky to retain the right numbers with numbered dots, and really messes things up if using auto-caption.)

Text and Shape opacity and giving a shape a halo

[edit]

With the 2021 changes to how the maps are displayed it has become possible to use opacity settings for both labels and the built-in shapes. For labels, use an additional '50%' indicator after the color name. (eg | label-color1 = soft grey 50% will make that text semi-transparent. Additional parameters are available to allow for transparency of both the shapes and outlines. In implementing this, it also became possible to offer a semi-transparent halo around built-in shapes and also around marks such as Red pog.svg. The table below shows a variety of possibilities for using these features.

Parameters to set opacity and a halo, with some examples.
|   shape-opacity=   <!-- provide a percentage opacity value for the fill color of 'built in shapes' --> 
|   outline-opacity= <!-- percentage opacity for the outline of a built in shape (nb, will be ignored for shapes with numbers)  -->
|   shape-halo=xx    <!-- highlights a shape or pog with a tranclucent 'halo', matching the shape-color, of width as specified in xx 
                          (5 is very thin, and increases by area rather than radius  -->
                     <!-- for the opacity values, both 0 and 100 create solid shapes, so use 1 for 'almost invisible' -->
                     <!-- if a shape is given an opacity other than 0 (which is the default), and also given a halo, the halo will just be an outer circle -->
Some ideas for using opacity and halo options
There are many use cases for both putting a halo around either shape or marker, to highlight it or indicate a zone of influence, for example. Similarly, using the opacity option for shapes can either retain visibility of the map below or indicate variable intensity of an item. As with all wikipedia graphics, the use should be driven by the needs of the data, and sources for underlying information should be correctly referenced.

Parameter settings for various options and combinations are shown below:-

Translucent circle to indicate a zone of interest:
|           shape1=circle
|       mark-size1=160
|     shape-color1=dark grey
|   shape-opacity1=20
| outline-opacity1=1
Translucent circles by setting default values: by using 'D' instead of a parameter number, its value is applied as default to all the markers.
|           shapeD=circle      
|   shape-opacityD=50          
| outline-opacityD=60
|   shape-outlineD=black
Use of a halo to highlight a particular pog marker.
| shape-halo2=16

(You can optionally also set the shape-color to a preferred halo color, which will not affect the pog marker)

Additional halo options with shapes and opacity

On this busy background, the numbered marks are given a 50% opacity, to allow some visibility of the map below. To highlight the dot number 4, it is given a 100% opacity and a halo. Note how any opacity that is not 0 forces the halo to change to an open circle instead of a translucent disc. (nb, when using the built in shapes, the halo will always take the same color setting as the shape itself).

| shape-opacityD=50
|    label-sizeD=11
|         shapeD=n-circle
|   shape-colorD=dark blue
| shape-outlineD=white

|    shape-halo4= 15
| shape-opacity4= 100
50% Opacity: Any of the named colors has an option to make it only 50% opaque. eg
|label1=SCOTLAND
| label-color1 = soft grey 50%
will produce a translucent grey, in which the background map also has some visibiliy. (nb only works with 50%. and generally only use it with label-colors, as it may conflict with the other opacity settings. See below for how to get further gradations)
  • And one of the Geeks!
| label-color=#1659165A

It is possible to set an opacity value for text as well. But it can only be done by adding it as an additional two-digit hex to a color given as a #value. This will not work with the built in color-names, but you can use the hex values shown in the color section below to match the built in colours. The transparency digits 7 and 8 are two optional hex numbers, using the form #RRGGBBTT, where the TT values are hex numbers setting opacity between 0 (transparent) and 255 (opaque).

Text effects

[edit]
multi-line label
Where label text is too long to fit on a single line, using label = , two further label lines can be used: labela = and labelb = .
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, illustrated by the 'Preseli Hills' text on the Pentre Ifan map. For stylistic consistency settlement and building names should not normally be given an angle.

Numbered dots

[edit]
Listed buildings in Stoneygate
1
St John The Baptist Church
2
Congregational Church
3
Eastfield, Stanley Road
4
Stoneygate School
5
The Firs
6
White House

If numbered dots are needed, instead of (or as well as) text labels, this can be achieved using the built in shapes. For example, shape1=n-circle will place a numbered dot at that coord position (or l-circle for letters). Generally it is much better to use the dots in sequence, so each numbered mark gives a numbered dot, and they will match the full screen ones. If auto-caption=1 then the caption will generate a numbered list using the mark-title entries. For example:-

{{OSM Location map
| coord={{coord|52.620|-1.112}}
| float=left| zoom =15
| width = 200  | height = 300
| mark-coord1 = {{coord|52.6180|-1.11189}}
| mark-title1 = St John The Baptist Church
| shape1=n-circle
| shape-color1=dark blue
| shape-outline1=white
| mark-size1=16
| mark-coord2 = {{coord|52.61819|-1.11035}}
| mark-title2 = Congregational Church
| mark-coord3 = {{coord|52.62324|-1.11179}}
| mark-title3 = Eastfield, Stanley Road
| mark-coord4 = {{coord|52.62123|-1.111297}}
| mark-title4 = Stoneygate School
| mark-coord5 = {{coord|52.62009|-1.11241}}
| mark-title5 = The Firs
| mark-coord6 = {{coord|52.61936|-1.11510}}
| mark-title6 = White House
| caption = Listed buildings in Stoneygate
| auto-caption=1
}}

The other built-in shapes can be used in the same way (n-square, n-diamond etc.). The shape-outline1= value sets the colour for the number (unlike normal, when it sets the shape-outline), and as with the others, only the mark1 parameter values need to be set, to establish the default for this map, which can be overridden as required. The numbered1..2..3 etc parameters can override the automatic numbers or letters to use your own values for each mark. {{Flushing Meadows-Corona Park map}} is a useful real life example in template form.

Use in infoboxes

[edit]

{{OSM Location map}} can be imbedded in infoboxes which allow the module parameter, 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).

Using label text to draw graphic features

[edit]

It is possible to use text labels to show simple graphics on a map, particularly by using unicode items in the Box Drawing selection. Copy and paste the individual characters as required, and set the relevant label-angle and label-size. Set the mark-size to 0 to avoid also getting a shape/dot. See example.

Multi-mark example that uses text as a drawing tool: Roman Walls at Caerleon
{{OSM Location map
| coord = {{coord|51.6105|-2.956}}
| zoom =15     | scalemark = 200
| width = 320  | height = 300
| caption =  Map of Caerleon, showing the line of the walls of the Roman Legionary Fortress of Isca Augusta, and some of the principal archaeological sites.
| auto-caption = 1

| minimap = file top right
| mini-file = Wales relief location map.jpg
| mini-width = 60 | mini-height = 78
| minipog-gx = 85 | minipog-gy = 78

| shapeD=n-circle
| shape-outlineD=white
| shape-colorD = hard blue
| mark-sizeD   = 16
| label-sizeD  = 16
| label-colorD = hard grey
| label-posD   = bottom
| label-offset-xD= 2
| label-offset-yD=-8

| mark-coord1 = {{coord|51.6102|-2.9552}}
| mark-title1 = [[National Roman Legion Museum]]
| mark-coord2 = {{coord|51.61007|-2.95386}}
| mark-title2 = Roman Fortress Baths (Museum)
| mark-coord3 = {{coord|51.6079|-2.9563}}
| mark-title3 = Legionary Amphitheatre
| mark-coord4 = {{coord|51.6110|-2.9592}}
| mark-title4 = The Barracks
| mark-coord5 = {{coord|51.6097|-2.9509}}
| mark-title5 = Medieval Castle Motte

| mark-coord10 = {{coord|51.6095|-2.9578}}
| label10      = ╰ ─ ─ ─ ─ ─ ─ ─ ─ ╯
| mark-title10 = none| mark-size10=0
| label-angle10=42
| mark-coord11 = {{coord|51.6121|-2.9540}}
| label11      = ╭ ─ ─ ─ ─ ─ ─ ─ ─ ╮ 
| mark-title11 = none| mark-size11=0
| label-angle11=40
| mark-coord12 = {{coord|51.6119|-2.9582}}
| label12      = ─ ─ ─ ─ ─ ─
| mark-title12 = none| mark-size12=0
| label-size12=17| label-angle12=132
| mark-coord13 = {{coord|51.6093|-2.9533}}
| label13      = ─ ─ ─ ─ ─ ─ ─
| mark-title13 = none| mark-size13=0
| label-angle13=133|

|     arc-coordA = {{coord|51.6074 |-2.9520 }}
|      arc-textA =  River Usk
| arc-text-sizeA = 12<!-- default is 12 -->
|arc-text-colorA = soft blue<!-- default is dark grey-->
|     arc-angleA = -60
|       arc-gapA = 6.6
|    arc-radiusA = 0.1
}}
Map of Caerleon, showing the line of the walls of the Roman Legionary Fortress of Isca Augusta, and some of the principal archaeological sites.
1
National Roman Legion Museum
2
Roman Fortress Baths (Museum)
3
Legionary Amphitheatre
4
The Barracks
5
Medieval Castle Motte

List of parameters

[edit]
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 = 
|           markD = 
|      mark-sizeD = 
|       mark-dimD = 
|     label-sizeD = 
|    label-colorD = 
|    label-angleD =
|      label-posD = 
| label-offset-xD = 
| label-offset-yD =  

    <!-- unumbered parameter set creates mark and/or label on the map -->
|     mark-coord = {{coord|  |  }}
|           mark = 
|          shape = 
|    shape-color = 
|  shape-outline = 
|      mark-size = 
|       mark-dim = 
|          label = 
|         labela = 
|         labelb =
|     label-size = 
|    label-color = 
|    label-angle =
|      label-pos = 
| label-offset-x = 
| label-offset-y =  
|     mark-title = 
|     mark-image = 
| mark-description=

<!-- Arc text (A, B and C) no shape, mark or fullscreen effects, just text placed on an arc. Coords are for the first letter.-->
| 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 30). Values set in mark1 will be inherited by all other numbered markers, unless overridden by a 'D' value-->
|     mark-coord1 = {{coord| | }}
|           mark1 = 
|          shape1 = 
|    shape-color1 = 
|  shape-outline1 = 
|      mark-size1 = 
|       mark-dim1 = 
|          label1 = 
|         labela1 = 
|         labelb1 =
|     label-size1 = 
|    label-color1 = 
|    label-angle1 =
|      label-pos1 = 
| label-offset-x1 = 
| label-offset-y1 =  
|     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 30 -->
}}

Parameters

[edit]
Map display parameters
Parameter Description
coord Latitude and longitude coordinates of the centre point of the map. Use coord={{Coord|latitude|longitude}}. {{Coord}} can deal with a wide range of formats. e.g.: coord={{Coord|57|18|22|N|4|27|32|W}}, coord={{Coord|44.112|N|87.913|W}}, coord={{Coord|44.112|-87.913}}. This may not be the 'coord' points of the page, as an appropriate framing area for the map may place the subject off-centre. (Marker point(s) are set separately, see below). gridreferencefinder.com, is a helpful place to find coordinates, or you can right=click on the 'Interactive fullscreen map.
zoom Sets the scale of the map, from 0 to 19, to the levels defined by OpenStreetMap. (details here). 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 hugely depending on the monitor being used, the browser magnification level, etc. For most Wikipedia situations, maps with a zoom of 10 (notionally 1:500,000) up to 16 (1:8,000) are likely to be of most use.
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.
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 By default an [Interactive Full screen] link is supplied in the bottom left of the frame. By setting this to 0 or no, the link will not appear, should that be preferred
nolabels By default the base map uses a map label model called 'osm-int'l', in which progressively higher zoom levels bring more place names onto the map, and since 2022 these have been 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. By setting nolabels = 1 an alternative 'osm' base map is used, with no place name labels. (At higher zooms the road names still occur). (nb. at present this does not support an editor being able to set a language/script local to the map. In such cases, adding in the required text label manually is the best option).
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 auto-caption=1, a numbered list will be automatically generated to follow any caption. This will generally only make sense when using numbered dots.
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 etc. can be included.

map-data-heavy
map-data-light
map-data
map-data-text
map-data-color
map-data-width

Allows OSM ExternalData elements to be added to the map. This can be an administrative boundary, highway or other 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 currently only allows line features (not areas etc.), which appear as various styles of line. Multiple elements can be added, separating each Q value by a comma. A major limitation, as of May 2017, is that it only appears on the 'fullscreen' map, not on the framed map on the page. Adding map-data items now should mean they appear on the page if and when this limitation is overcome. nominatim.openstreetmap.org/ has a search engine to identify data elements for which Q values have been assigned, or to add wikidata Q values to map elements.

For map-data-heavy and map-data-light, this will draw orange lines of thickness 9 and 3 pixels respectively. map-data is more flexible, so can default to an orange line of 6 pixels, but color (using format #XXXXXX) and width in pixels can be set, as can a text element which appears when the line is clicked on. This can include wikilinks.

minimap
Automated world map
Used to add an optional locator minimap in the bottom right or left corner. If set to on it adds a 'built in' small(ish) world map with a locator dot showing the position of the main map. (This is a feature supplied by the underlying 'Graph:' template, so the only control over it can only be bottom right and is to be set as on or off. Other 'mini' parameters should be left blank). If set to off or not included a map is not used.
External map
To allow a map from wikimedia commons, plus optional locator dot, set to file it requires the next section details to be added, which will include a custom map and can be placed in any of the four corners.
minimap=file bottom left
minimap=file bottom right
minimap=file top left
minimap=file top right

If just minimap=file is used it defaults to 'bottom right', but it is probably better to spell it out.

mini-file

mini-width
mini-height

Takes the file name of a standard location map from Commons (without File:), and displays it as a minimap in a corner, provided minimap=file.

mini-width and mini-height are the desired dimensions of this minimap, in pixels. The ratio mini-width/mini-height must equal width/height of the mini-file to avoid distortion.

minipog-gx
minipog-gy
minimap-boxwidth

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 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 rest numbered 1 to 60. The first numbered one, (mark1, label1, etc.) is a 'master marker' and its values (or defaults) are inherited by the other numbered markers unless set individually. All label, mark and full-screen parameters are available for each numbered marker.

If the un-numbered mark is used as the subject of the map, it will be point 1 on the Full Screen map (unless mark-title=none) and can use specific mark and label values of its own. The first numbered mark has values that will be inherited by subsequent marks. For added flexibility a parameter set with a 'D' value instead of a number will override the master values with a more general Default.

Parameter Description
shape OSM Location map can use either an external image as a location marker, or one of various built-in shapes. Shape should either be set as =image or can be a circle, square, cross, diamond, triangle-up or triangle-down. If blank or absent it will default to 'image', and use either a Red pog.svg or specified mark = image. If numbered dots are required, use shape1=n-circle Subsequent markers will use the same setting, and automatically number up to 30. shape1=l-circle will do the same but with letters, and any of the built in shapes can be used.
shape-color
shape-outline
numbered
Set the shape infill and outline to any color, using either the color names shown under 'label-color' blow, or hex triplets (e.g. #FF0000), as described at Web colors. Only used for built in shapes. Setting them to the same value gives an appearance of no outline. Default = #B80000 (a dark red). The numbered = parameter is used with numbered shapes, to override the automatically allocated number.
shape-opacity
outline-opacity
Set the opacity value for fill and outline of built-in shapes, as a percentage. 100 = a solid color, 1 = transparent. Note that 0 also = solid color, the same as having no opacity value set, which is the default state.
shape-halo Sets a halo around a shape or mark. Give a size value for the halo, which relates to the area rather than diameter of the shape, and is in addition to the original shape-size. For example a mark-size=10 and shape-halo=15 will have a useful halo alround the mark. With shape-opacity of zero/undefined the halo will be a translucent filled shape to match the built-in shape, or in the case of pogs and other image files, a circle. For any other opacity value upto and including 100, the halo will be a translucent outline rather than infilled shape.
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
mark-size
mark-dim
Size and dimensions of a marker. mark-size is used by both shape and mark to define the size of the marker symbol. It sets the height of the mark or shape in pixels (no 'px' required, default is 10). If only a text label is wanted with no marker, set mark-size=0.
mark-dim is used to give a non-square mark. (It has no effect with the built in shapes.) default is 1, i.e. equal width and height. A value of 1.4 will give a typical landscape rectangle. 0.7 will give a typical portrait rectangle. If the original mark-file is non square, a value here is needed to correct the proportions.
mark-coord Latitude and longitude coordinates of the marker point. Use the format mark-coord={{Coord|lat value|lon value}}. Used by either 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
labela
labelb
Text to appear alongside a mark or shape. No inline formatting, line wrapping, or other tags, links etc. are possible. If left blank then any mark will show without a label. If only a text label is wanted with no marker, set mark-size=0 A blank label and a mark-size=0 will result in an invisible marker, which will still feature on the Full screen option. If the label is too long for a single line, use labela and labelb for 2nd and 3rd lines. nb if labelb is set without a labela, there will still be a gap where labela would go.
label-size Sets the text size for the label, in points. default = 10
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.

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)
Full table of colors recommended for OSM Maps.

These have a more pastel shade than the standard colors, so blend effectively with the map backgrounds

soft red #DB3123 hard red #AA1205 dark red #7A0101
soft green #81AF81 hard green #538253 dark green #165916
soft blue #77A1CB hard blue #5581A9 dark blue #5581A9
soft grey #AAAA88 hard grey #777755 dark grey #333322
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

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'

Any text other than one of the named colors above or a hex code will return as 'dark grey'

label-pos Sets the position of the label, relative to the marker: left, right, top or bottom. Default=left. Top and bottom 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.
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.
label-offset-x
label-offset-y
Allows adjustment of the label location in an x and y direction, relative to its mark coordinates, by the specified number of pixels. It can be +ve or -ve numbers. Higher -x values will move the label to the right. Higher -y values move it down the map. Default is 0,0.
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 via 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).
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
The use of arc-text parameters allows a short text (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). The nature of the earth's coordinate system means that there will be some variation in an arc at different latitudes and at different zoom levels. Some allowance is factored in, but there will still be residual variation. Similarly, changes in radius will also have some effect on the gap size, with a larger radius opening out the gap somewhat. There will therefore need to be a degree of trial and correction 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, dependent on latitude and zoom level
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.

Underlying technology

[edit]

OSM Location map itself has no map or display ability of its own. Everything within the frame is produced through the template {{Graph:Street map with marks}}, created by User:Yurik. This in turn calls internal processes that turn all the data supplied into a rendered bitmap image. As of 2020, this has been carried out as required for each page view, creating a considerable resource overhead. Hopefully this is being kept in bounds by caching systems, but does mean the resulting images are at the highest resolution, with a major improvement in appearance.

Until 2020 a map being edited and previewed was supplied as a rasterised image, collating the base-map, marks, labels, etc. on the fly, but when the 'Publish Changes' button is pressed, it generated a lower-resolution bitmap with much worse fonts than the preview. Unfortunately, with both the old and new rasterisation methods, there is still no text or objects on the final image, so there is no possibility of adding wikilinks or clickable hot-spots to the maps.

The full screen option, which can be clicked through from below the map, provides an entirely different mapping approach, using the same base-map data. This provides an interactive map that can be panned and zoomed. It also replicates (although at present only as numbered markers) the various marks from the page map. These can then be given more content, by way of a title, caption and image along with displaying the coordinate values. The caption and title can then be given all the wikilinks and other markup features that may be desired, providing a map-based page that will offer another way of engaging with the article content.

Future development of the various mapping technologies is likely to result in further options for showing maps on Wikipedia. In particular, {{maplink}}, which initially just created a text link to a full-screen map, can now create a framed image including dot-markers, roads, boundaries, etc., and can acquire data directly from wikidata to do this. Again, the processor overheads are reduced by initially showing a bitmap, which can be clicked to become interactive within its frame. Maplink is being effectively rolled out within info-boxes, where the map is automatically generated from already available data.

This template, on the other hand, is probably better suited to 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 within this template, but is available via the inderlying {{Graph:Street map with marks}} template, is to draw the data from Wikidata, using a SPARQL query that provides the selection of marks requested.

The 'Graph' technology used here is still best described as under development, so while it is highly likely that this or a similar solution will still be available, it may evolve over time.

See also

[edit]