Template:OSM Location map/Return to service

OSM Location Map Return to Service, 2024
In April 2023 WMF identified security concerns that required withdrawal of the 'Graph' module, which gave access to the Vega v2 graphics services. This had carried out three key tasks for this template: show the right portion of the OSM maps; translate Mercator coordinates into x,y frame coordinates; and produce graphic symbols, images and text that it placed on the maps. What was initially expected to be a short pause while security issues were addressed stretched out over months as WMF found intractable obstacles with the upgrade to Vega v5, because of continuing security concerns, excessive demands on page-load times and difficulties in guaranteeing resources for future maintenance.

The extended outage gave time to grapple with the Mercator translation maths, allowing x,y to be generated by wikitext. However it was only once the capabilities of CSS graphics (already built in to wikipedia) were explored, and the 'overlay' facility at maplink was understood (a bit), that the three elements were in place to re-build OSM Location map without the need for the 'Graph' module or its Vega underpinnings. (At the time of writing, Vega 5 remains undeployed, which leaves large numbers of graphs, particularly those using external data sources and interactive uses, with no replacement in sight.) The new version of this template aims towards a 'near-identical' use of the 5,600 pre-existing maps, which should return displays close to those originally intended rather than the previous temporary solution of showing only maplink markers. As a bonus, the re-write has allowed some useful extras to be added by way of additional graphical elements and control options.

Shortcomings of the new version
As at March 2024 the biggest shortcoming of the CSS version was text placement. ✅ Thankfully this is solved, and is now reliably placing text a 'nice distance' to the right/left/abobe/below a symbol. (Note the interim 'justify-offset' parameter, jdx=, is now redundent and not used, so can be taken off any template uses.

It is also the case that with different code, and different methods of calling both graphics and text, the sizes and placements may vary slightly from the old version. However with that said, it is hoped that most maps will look very much as they used to. One impacted feature is ArcText. It previously needed to make numerous adjustments with the change in zoom and latitude. The CSS version has avoided this, which should make it more predictable to use, but will not give the same outcomes as before, with hand-editing needed to fit the new scheme. It is possible that better rendering of text in some cases will be as a label. It affects a very small number of maps, and is likely to be 'additional' rather than 'core' content. (✅ wobbly arc-text is now evened out, through better use of css.)

The rarely used 'Halo' feature has been left out of the re-write, in the cause of simplifying things. Something similar is possible with shape-outline. Open a discussion on the talk page if you would like to see this implemented.

Larger images, such as transparent overlays, have also ended up not on the same placement as before. This is an outcome of such a different sizing model compared to the old system, compounded by a decision to harmonise the 'shape' and 'image' sizes. Unfortunately any overlays will probably need to be re-sized and positioned to get them right.

New Features now available
for a page of examples that utilise some of the new features.

Fullscreen link
maplink places a 'fullscreen link' box in the top-right corner, so this has been utilised as the place to click to get the full-screen version, instead of having text at the top of the caption.

'Live' wikilinks for marks
For the first time the marks can be clicked to link through to an article. This uses the information supplied in 'mark-title' (which is also used by auto-caption and 'fullscreen'), so many pages will now already have live dots on their map. It Wikilinks the first link (if there are several), which appears as a tooltip text-box when you hover over a live mark. Any mark where no link is supplied has no action. (Is this better than a 'page does not exist' message?) This is a new development, so may need some improving. In particular, should there be some sort of visual indication that a dot is 'live' or not? (Try finding the 5 live-links in the demo map on the right.)

Administrative Boundaries
This was barely onto a 'hoped for' list, having been restricted to fullscreen only throughout the life of this template. But suddenly, ✅, it is possible to show boundaries, and potentially other linear features, on the page, within the frame. Proceeding with a degree of caution, it is looking like it could be a really useful element. It is a pity it can't do dashes etc. It is limited to solid lines, but they can be given a lot of transparency, so can drop down to the background very nicely. Set using 'Qvalues', available at wikidata pages, and set using map-data.

columns for auto-caption
The auto-caption= can now specify a column width (in ems), so that the list of numbered items can be split into several columns.

Drawing Order
Under the graph system, all shapes were drawn first, and text overlaid next. This way of doing things is not possible now. Each shape, label and numbered text is drawn in turn, so that the next will potentially overwrite the earlier. With this in mind, it seemed best to consider mark1 as the primary item, ie the one to be on top, and the higher numbers to be below them. It may be that some re-numbering will be needed if this obscures important information. There are also, however, options described below to move labels and numbers away from congested areas, by using a connecting line.

short-form for label-offsets
You will see below that to draw various lines from a shape, the label-offset-x and y parameters are used. To streamline this, alternative short forms, ldx and ldy, are now possible (d being the 'offset variable;). Thus ldx4=-25| ldy4=-15 will identify a location left and above the shape. Positive values would take it to the right and below, respectively.

An interim offset was jdx=. It moved labels that are left, center, top or bottom positioned, horizontally left or right, to compensate for a more basic text positioning method. A better method has now been found to align correctly on all sides, so jdx now has no effect.

Multi-item parameters
In an attempt to streamline the template content, there are now several parameters that can include more than one value, separated by commas. These are:
 * mark-size= which can include width,height,corner-radius. (values in px. Only width is essential)
 * shape-color= which can have color,opacity (opacity out of 100. This is the same as setting the now-redundant shape-opacity=. Note, for compatibility, 1 is invisible, through to 100 opaque. 0 and undefined are also opaque.
 * shape-outline= color,line-thickness,opacity,css-style. (line-thickness is in px, with 0 meaning no outline. Opacity works the same as for shape-color. css style has various options of which the most useful are solid, dotted, dashed or double. This last allows a shape to be given a second outline around the shape. For example  would give a 'halo effect'.
 * label-pos= now incorporates several ways of drawing connecting lines - see below.

New Graphical elements
These are all available as numbered parameters, for use with any of the 60 marks, with or without numbering or labels.

The main documentation page has also now been updated to include summaries of this information.