Text on an arc
This sub-template is used by {{OSM Location map}} to provide a facility to place text that follows an arc across the map. In conjection with other labels, markers and map features, this allows text for larger geographic features 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 in the template. It does not attach itself to any mark or dot, and does not create any fullscreen markers. It requires coordinates for the location of the first letter, and additional 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-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 -->
| 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 -->
| ellipse-factorA=1.0 <!-- 1= 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: <graph> { // // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:Street_map_with_marks // Please do not modify it anywhere else, as it may get copied and override your changes. // Suggestions can be made at https://www.mediawiki.org/wiki/Template_talk:Graph:Street_map_with_marks // // Template translation is in https://commons.wikimedia.org/wiki/Data:Original/Template:Graphs.tab // "version": 2, "width":200, "height": 100, "padding": 0, "signals":[ // These signals allow us to quickly move the map within the image, e.g. to leave space for the legend {"name":"legendWidth", "init": {"expr": "0"} }, {"name":"legendHeight", "init": {"expr": "height"} },
{"name":"imgWidth", "init": {"expr": "width-legendWidth"} },
{"name":"imgHeight", "init": {"expr": "height"} },
{"name":"imgXC", "init": {"expr": "imgWidth/2"} },
{"name":"imgYC", "init": {"expr": "imgHeight/2"} },
{"name":"imgTileSize", "init": {"expr": "256"} },
{"name":"imgLat", "init": {"expr": ""} },
{"name":"imgLon", "init": {"expr": "Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil)."} },
{"name":"imgZoom", "init": {"expr": "15"} },
{"name":"picWidth", "init": {"expr": "180"} },
{"name":"picHeight", "init": {"expr": "picWidth/2"} },
{"name":"picXC", "init": {"expr": "imgWidth-(picWidth/2)"} },
{"name":"picYC", "init": {"expr": "imgHeight-(picHeight/2)"} },
{"name":"showMiniMap", "init": {"expr": "0"} }
],
"data": [
{
"name": "data",
// Otherwise use the first unnamed argument for source values "values": [ { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"img": "wikirawupload:",
"width": 50,
"height": 8,
"offsetX": 63,
"offsetY": 32,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"width": 0,
"height": 0,
"size": 0,
"offsetX": 63,
"offsetY": 44,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": 0, "lon": 0, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
} , { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "S", "textAngle": -350, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "h", "textAngle": -352.00703217198, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "a", "textAngle": -354.01406434396, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "l", "textAngle": -356.02109651593, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "l", "textAngle": -358.02812868791, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "o", "textAngle": -360.03516085989, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "w", "textAngle": -362.04219303187, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -364.04922520385, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "S", "textAngle": -366.05625737582, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "m", "textAngle": -368.0632895478, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "i", "textAngle": -370.07032171978, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "l", "textAngle": -372.07735389176, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "e", "textAngle": -374.08438606373, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -380.10548257967, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -382.11251475165, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -384.11954692362, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}
"lat": 0.1, "lon": 0.1, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
}
], "transform": [ { "type": "geo", "projection": "mercator", "scale": {"expr": "imgTileSize/PI/2*pow(2,imgZoom)"}, "translate": [{"expr": "imgXC"}, {"expr": "imgYC"}], "center": [{"expr": "imgLon"}, {"expr": "imgLat"}], "lon": "lon", "lat": "lat" }, { "type": "formula", "field":"layout_x", "expr": "datum.layout_x + (datum.offsetX || 0)" }, { "type": "formula", "field":"layout_y", "expr": "datum.layout_y + (datum.offsetY || 0)" }, { "type": "formula", "field":"color", "expr": "datum.color || '#c33'" }, { "type": "formula", "field":"textColor", "expr": "datum.textColor || datum.color" }, { "type": "formula", "field":"strokeColor", "expr": "datum.strokeColor || '#ffe7e6'" } ] }, { // Hack: single value data source for drawing/hiding images and other non-series elements "name": "dummyData", "values": [{}] } ], // Legend only works if showLegend and colorScaleField are set "marks": [ { "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "formula", "field":"url", "expr": "'mapsnapshot:///?width='+imgWidth+'&height='+imgHeight+'&zoom='+imgZoom+'&lat='+imgLat+'&lon='+imgLon+'&lang=en'" } ] }, "properties": { "enter": { "url": {"field": "url"}, "xc": {"signal": "imgXC"}, "yc": {"signal": "imgYC"}, "width": {"signal": "imgWidth"}, "height": {"signal": "imgHeight"} } } }, { // Places an image of a given name and size at the [lan,lon] location "type": "image", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.img" }, { "type": "formula", "field":"iconWidth", "expr": "datum.width || 0" }, { "type": "formula", "field":"iconHeight", "expr": "datum.height || 0" }, { "type": "formula", "field":"img", "expr": "if(!test(/^[a-z]+:\\/\\//, datum.img), 'wikifile:///'+datum.img, datum.img)" }, // Ensure that either width or height parameter is passed to wikifile:// request { "type": "formula", "field":"img", "expr": "if((datum.iconWidth || datum.iconHeight) && !test(/[?&](width|height)=\\d/, datum.img),if(datum.iconWidth,datum.img+'?width='+datum.iconWidth,datum.img+'?height='+datum.iconHeight), datum.img)" } ]}, "properties": { "enter": { "url": {"field": "img"}, "xc": {"field": "layout_x"}, "yc": {"field": "layout_y"}, "width": {"field": "iconWidth"}, "height": {"field": "iconHeight"} } } }, { // Draw marks of a given color, shape, and size at the [lan,lon] location "type": "symbol", "from": { "data": "data", "transform": [{ "type": "filter", "test": "!datum.img" }] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, // If colorScaleField is set, use color scaling, otherwise use the preset color value "fill": { "field": "color" }, "size": {"field": "size"}, "shape": {"field": "shape"}, "stroke": {"field": "strokeColor"} } } }, { // Draw text with the given color and size at the [lan,lon] location // See https://github.com/vega/vega/wiki/Marks#text for all parameter description (prepend "text" and capitalize them) "type": "text", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.text" }, // Figure out if this is an LTR or RTL page. For LTR, show label to the right of the icon, left-aligned. For RTL, reverse. { "type": "formula", "field":"isLTR", "expr": "'' == '\\u200E'" }, // If these values are not defined ("undefined" is not allowed, so test for truthiness and not 0) { "type": "formula", "field":"textDx", "expr": "if(!datum.textDx && datum.textDx != 0, if(datum.isLTR,8,-8), datum.textDx)" }, { "type": "formula", "field":"textAlign", "expr": "if(!datum.textAlign, if(datum.isLTR,'left','right'), datum.textAlign)" }, { "type": "formula", "field":"textBaseline", "expr": "datum.textBaseline || 'middle'" } ]}, "properties": { "enter": { "text": {"field": "text"}, "x": {"field": "layout_x" }, "y": {"field": "layout_y"}, "dx": {"field": "textDx" }, "dy": {"field": "textDy"}, "fill": {"field": "textColor"}, "align": {"field": "textAlign"}, "baseline": {"field": "textBaseline"}, "radius": {"field": "textRadius"}, "theta": {"field": "textTheta"}, "angle": {"field": "textAngle"}, "font": {"field": "textFont"}, "fontSize": {"field": "textFontSize"}, "fontWeight": {"field": "textFontWeight"}, "fontStyle": {"field": "textFontStyle"} } } }, { // Draw a low-zoom locator map frame "type": "rect", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" } ] }, "properties": { "enter": { "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth", "offset":2}, "height": {"signal": "picHeight"}, "stroke": {"value":"#fff"},"strokeWidth": {"value":6} } } }, { // Draw a low-zoom locator map by using a premade world map image "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"url", "expr": "1" } ] }, "properties": { "enter": { "url": {"value": "wikirawupload:"}, "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth"}, "height": {"signal": "picHeight"} } } }, { // Draw a zoom-out mark at the [lan,lon] location "type": "symbol", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"lat", "expr": "imgLat" }, { "type": "formula", "field":"lon", "expr": "imgLon" }, { "type": "geo", "projection": "equirectangular", "scale": {"expr": "180/2/PI"}, "translate": [{"expr": "picXC"}, {"expr": "picYC"}], "center": [{"expr": "0"}, {"expr": "0"}], "lon": "lon", "lat": "lat" } ] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, "fill": {"value": "#c33"}, "stroke": {"value": "#ffe7e6"}, "size": {"value": 40} } } } ] } </graph> arc-angleA=-170 arc-gapA=-1.2 arc-radiusA=1.6 |
Deeper smile: <graph> { // // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:Street_map_with_marks // Please do not modify it anywhere else, as it may get copied and override your changes. // Suggestions can be made at https://www.mediawiki.org/wiki/Template_talk:Graph:Street_map_with_marks // // Template translation is in https://commons.wikimedia.org/wiki/Data:Original/Template:Graphs.tab // "version": 2, "width":200, "height": 100, "padding": 0, "signals":[ // These signals allow us to quickly move the map within the image, e.g. to leave space for the legend {"name":"legendWidth", "init": {"expr": "0"} }, {"name":"legendHeight", "init": {"expr": "height"} },
{"name":"imgWidth", "init": {"expr": "width-legendWidth"} },
{"name":"imgHeight", "init": {"expr": "height"} },
{"name":"imgXC", "init": {"expr": "imgWidth/2"} },
{"name":"imgYC", "init": {"expr": "imgHeight/2"} },
{"name":"imgTileSize", "init": {"expr": "256"} },
{"name":"imgLat", "init": {"expr": ""} },
{"name":"imgLon", "init": {"expr": "Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil)."} },
{"name":"imgZoom", "init": {"expr": "15"} },
{"name":"picWidth", "init": {"expr": "180"} },
{"name":"picHeight", "init": {"expr": "picWidth/2"} },
{"name":"picXC", "init": {"expr": "imgWidth-(picWidth/2)"} },
{"name":"picYC", "init": {"expr": "imgHeight-(picHeight/2)"} },
{"name":"showMiniMap", "init": {"expr": "0"} }
],
"data": [
{
"name": "data",
// Otherwise use the first unnamed argument for source values "values": [ { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"img": "wikirawupload:",
"width": 50,
"height": 8,
"offsetX": 63,
"offsetY": 32,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"width": 0,
"height": 0,
"size": 0,
"offsetX": 63,
"offsetY": 44,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": 0, "lon": 0, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
} , { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "D", "textAngle": -330, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "e", "textAngle": -335.02041795074, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "e", "textAngle": -340.04083590148, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "p", "textAngle": -345.06125385223, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "e", "textAngle": -350.08167180297, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "r", "textAngle": -355.10208975371, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -360.12250770445, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "S", "textAngle": -365.1429256552, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "m", "textAngle": -370.16334360594, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "i", "textAngle": -375.18376155668, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "l", "textAngle": -380.20417950742, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "e", "textAngle": -385.22459745817, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -390.24501540891, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -405.30626926114, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -410.32668721188, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -415.34710516262, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}
"lat": 0.1, "lon": 0.1, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
}
], "transform": [ { "type": "geo", "projection": "mercator", "scale": {"expr": "imgTileSize/PI/2*pow(2,imgZoom)"}, "translate": [{"expr": "imgXC"}, {"expr": "imgYC"}], "center": [{"expr": "imgLon"}, {"expr": "imgLat"}], "lon": "lon", "lat": "lat" }, { "type": "formula", "field":"layout_x", "expr": "datum.layout_x + (datum.offsetX || 0)" }, { "type": "formula", "field":"layout_y", "expr": "datum.layout_y + (datum.offsetY || 0)" }, { "type": "formula", "field":"color", "expr": "datum.color || '#c33'" }, { "type": "formula", "field":"textColor", "expr": "datum.textColor || datum.color" }, { "type": "formula", "field":"strokeColor", "expr": "datum.strokeColor || '#ffe7e6'" } ] }, { // Hack: single value data source for drawing/hiding images and other non-series elements "name": "dummyData", "values": [{}] } ], // Legend only works if showLegend and colorScaleField are set "marks": [ { "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "formula", "field":"url", "expr": "'mapsnapshot:///?width='+imgWidth+'&height='+imgHeight+'&zoom='+imgZoom+'&lat='+imgLat+'&lon='+imgLon+'&lang=en'" } ] }, "properties": { "enter": { "url": {"field": "url"}, "xc": {"signal": "imgXC"}, "yc": {"signal": "imgYC"}, "width": {"signal": "imgWidth"}, "height": {"signal": "imgHeight"} } } }, { // Places an image of a given name and size at the [lan,lon] location "type": "image", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.img" }, { "type": "formula", "field":"iconWidth", "expr": "datum.width || 0" }, { "type": "formula", "field":"iconHeight", "expr": "datum.height || 0" }, { "type": "formula", "field":"img", "expr": "if(!test(/^[a-z]+:\\/\\//, datum.img), 'wikifile:///'+datum.img, datum.img)" }, // Ensure that either width or height parameter is passed to wikifile:// request { "type": "formula", "field":"img", "expr": "if((datum.iconWidth || datum.iconHeight) && !test(/[?&](width|height)=\\d/, datum.img),if(datum.iconWidth,datum.img+'?width='+datum.iconWidth,datum.img+'?height='+datum.iconHeight), datum.img)" } ]}, "properties": { "enter": { "url": {"field": "img"}, "xc": {"field": "layout_x"}, "yc": {"field": "layout_y"}, "width": {"field": "iconWidth"}, "height": {"field": "iconHeight"} } } }, { // Draw marks of a given color, shape, and size at the [lan,lon] location "type": "symbol", "from": { "data": "data", "transform": [{ "type": "filter", "test": "!datum.img" }] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, // If colorScaleField is set, use color scaling, otherwise use the preset color value "fill": { "field": "color" }, "size": {"field": "size"}, "shape": {"field": "shape"}, "stroke": {"field": "strokeColor"} } } }, { // Draw text with the given color and size at the [lan,lon] location // See https://github.com/vega/vega/wiki/Marks#text for all parameter description (prepend "text" and capitalize them) "type": "text", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.text" }, // Figure out if this is an LTR or RTL page. For LTR, show label to the right of the icon, left-aligned. For RTL, reverse. { "type": "formula", "field":"isLTR", "expr": "'' == '\\u200E'" }, // If these values are not defined ("undefined" is not allowed, so test for truthiness and not 0) { "type": "formula", "field":"textDx", "expr": "if(!datum.textDx && datum.textDx != 0, if(datum.isLTR,8,-8), datum.textDx)" }, { "type": "formula", "field":"textAlign", "expr": "if(!datum.textAlign, if(datum.isLTR,'left','right'), datum.textAlign)" }, { "type": "formula", "field":"textBaseline", "expr": "datum.textBaseline || 'middle'" } ]}, "properties": { "enter": { "text": {"field": "text"}, "x": {"field": "layout_x" }, "y": {"field": "layout_y"}, "dx": {"field": "textDx" }, "dy": {"field": "textDy"}, "fill": {"field": "textColor"}, "align": {"field": "textAlign"}, "baseline": {"field": "textBaseline"}, "radius": {"field": "textRadius"}, "theta": {"field": "textTheta"}, "angle": {"field": "textAngle"}, "font": {"field": "textFont"}, "fontSize": {"field": "textFontSize"}, "fontWeight": {"field": "textFontWeight"}, "fontStyle": {"field": "textFontStyle"} } } }, { // Draw a low-zoom locator map frame "type": "rect", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" } ] }, "properties": { "enter": { "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth", "offset":2}, "height": {"signal": "picHeight"}, "stroke": {"value":"#fff"},"strokeWidth": {"value":6} } } }, { // Draw a low-zoom locator map by using a premade world map image "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"url", "expr": "1" } ] }, "properties": { "enter": { "url": {"value": "wikirawupload:"}, "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth"}, "height": {"signal": "picHeight"} } } }, { // Draw a zoom-out mark at the [lan,lon] location "type": "symbol", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"lat", "expr": "imgLat" }, { "type": "formula", "field":"lon", "expr": "imgLon" }, { "type": "geo", "projection": "equirectangular", "scale": {"expr": "180/2/PI"}, "translate": [{"expr": "picXC"}, {"expr": "picYC"}], "center": [{"expr": "0"}, {"expr": "0"}], "lon": "lon", "lat": "lat" } ] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, "fill": {"value": "#c33"}, "stroke": {"value": "#ffe7e6"}, "size": {"value": 40} } } } ] } </graph> arc-angleA=-150 arc-gapA=-3 arc-radiusA=0.7 |
wide eyebrow: <graph> { // // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:Street_map_with_marks // Please do not modify it anywhere else, as it may get copied and override your changes. // Suggestions can be made at https://www.mediawiki.org/wiki/Template_talk:Graph:Street_map_with_marks // // Template translation is in https://commons.wikimedia.org/wiki/Data:Original/Template:Graphs.tab // "version": 2, "width":200, "height": 100, "padding": 0, "signals":[ // These signals allow us to quickly move the map within the image, e.g. to leave space for the legend {"name":"legendWidth", "init": {"expr": "0"} }, {"name":"legendHeight", "init": {"expr": "height"} },
{"name":"imgWidth", "init": {"expr": "width-legendWidth"} },
{"name":"imgHeight", "init": {"expr": "height"} },
{"name":"imgXC", "init": {"expr": "imgWidth/2"} },
{"name":"imgYC", "init": {"expr": "imgHeight/2"} },
{"name":"imgTileSize", "init": {"expr": "256"} },
{"name":"imgLat", "init": {"expr": ""} },
{"name":"imgLon", "init": {"expr": "Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil)."} },
{"name":"imgZoom", "init": {"expr": "15"} },
{"name":"picWidth", "init": {"expr": "180"} },
{"name":"picHeight", "init": {"expr": "picWidth/2"} },
{"name":"picXC", "init": {"expr": "imgWidth-(picWidth/2)"} },
{"name":"picYC", "init": {"expr": "imgHeight-(picHeight/2)"} },
{"name":"showMiniMap", "init": {"expr": "0"} }
],
"data": [
{
"name": "data",
// Otherwise use the first unnamed argument for source values "values": [ { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"img": "wikirawupload:",
"width": 50,
"height": 8,
"offsetX": 63,
"offsetY": 32,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"width": 0,
"height": 0,
"size": 0,
"offsetX": 63,
"offsetY": 44,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": 0, "lon": 0, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
} , { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "E", "textAngle": -20, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "y", "textAngle": -14.979887925816, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "e", "textAngle": -9.9597758516314, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "b", "textAngle": -4.9396637774471, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "r", "textAngle": 0.080448296737199, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "o", "textAngle": 5.1005603709215, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "w", "textAngle": 10.120672445106, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": 15.14078451929, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": 20.160896593474, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": 25.181008667659, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": 30.201120741843, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": 35.221232816027, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": 40.241344890212, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": 55.301681112764, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": 60.321793186949, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": 65.341905261133, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}
"lat": 0.1, "lon": 0.1, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
}
], "transform": [ { "type": "geo", "projection": "mercator", "scale": {"expr": "imgTileSize/PI/2*pow(2,imgZoom)"}, "translate": [{"expr": "imgXC"}, {"expr": "imgYC"}], "center": [{"expr": "imgLon"}, {"expr": "imgLat"}], "lon": "lon", "lat": "lat" }, { "type": "formula", "field":"layout_x", "expr": "datum.layout_x + (datum.offsetX || 0)" }, { "type": "formula", "field":"layout_y", "expr": "datum.layout_y + (datum.offsetY || 0)" }, { "type": "formula", "field":"color", "expr": "datum.color || '#c33'" }, { "type": "formula", "field":"textColor", "expr": "datum.textColor || datum.color" }, { "type": "formula", "field":"strokeColor", "expr": "datum.strokeColor || '#ffe7e6'" } ] }, { // Hack: single value data source for drawing/hiding images and other non-series elements "name": "dummyData", "values": [{}] } ], // Legend only works if showLegend and colorScaleField are set "marks": [ { "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "formula", "field":"url", "expr": "'mapsnapshot:///?width='+imgWidth+'&height='+imgHeight+'&zoom='+imgZoom+'&lat='+imgLat+'&lon='+imgLon+'&lang=en'" } ] }, "properties": { "enter": { "url": {"field": "url"}, "xc": {"signal": "imgXC"}, "yc": {"signal": "imgYC"}, "width": {"signal": "imgWidth"}, "height": {"signal": "imgHeight"} } } }, { // Places an image of a given name and size at the [lan,lon] location "type": "image", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.img" }, { "type": "formula", "field":"iconWidth", "expr": "datum.width || 0" }, { "type": "formula", "field":"iconHeight", "expr": "datum.height || 0" }, { "type": "formula", "field":"img", "expr": "if(!test(/^[a-z]+:\\/\\//, datum.img), 'wikifile:///'+datum.img, datum.img)" }, // Ensure that either width or height parameter is passed to wikifile:// request { "type": "formula", "field":"img", "expr": "if((datum.iconWidth || datum.iconHeight) && !test(/[?&](width|height)=\\d/, datum.img),if(datum.iconWidth,datum.img+'?width='+datum.iconWidth,datum.img+'?height='+datum.iconHeight), datum.img)" } ]}, "properties": { "enter": { "url": {"field": "img"}, "xc": {"field": "layout_x"}, "yc": {"field": "layout_y"}, "width": {"field": "iconWidth"}, "height": {"field": "iconHeight"} } } }, { // Draw marks of a given color, shape, and size at the [lan,lon] location "type": "symbol", "from": { "data": "data", "transform": [{ "type": "filter", "test": "!datum.img" }] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, // If colorScaleField is set, use color scaling, otherwise use the preset color value "fill": { "field": "color" }, "size": {"field": "size"}, "shape": {"field": "shape"}, "stroke": {"field": "strokeColor"} } } }, { // Draw text with the given color and size at the [lan,lon] location // See https://github.com/vega/vega/wiki/Marks#text for all parameter description (prepend "text" and capitalize them) "type": "text", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.text" }, // Figure out if this is an LTR or RTL page. For LTR, show label to the right of the icon, left-aligned. For RTL, reverse. { "type": "formula", "field":"isLTR", "expr": "'' == '\\u200E'" }, // If these values are not defined ("undefined" is not allowed, so test for truthiness and not 0) { "type": "formula", "field":"textDx", "expr": "if(!datum.textDx && datum.textDx != 0, if(datum.isLTR,8,-8), datum.textDx)" }, { "type": "formula", "field":"textAlign", "expr": "if(!datum.textAlign, if(datum.isLTR,'left','right'), datum.textAlign)" }, { "type": "formula", "field":"textBaseline", "expr": "datum.textBaseline || 'middle'" } ]}, "properties": { "enter": { "text": {"field": "text"}, "x": {"field": "layout_x" }, "y": {"field": "layout_y"}, "dx": {"field": "textDx" }, "dy": {"field": "textDy"}, "fill": {"field": "textColor"}, "align": {"field": "textAlign"}, "baseline": {"field": "textBaseline"}, "radius": {"field": "textRadius"}, "theta": {"field": "textTheta"}, "angle": {"field": "textAngle"}, "font": {"field": "textFont"}, "fontSize": {"field": "textFontSize"}, "fontWeight": {"field": "textFontWeight"}, "fontStyle": {"field": "textFontStyle"} } } }, { // Draw a low-zoom locator map frame "type": "rect", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" } ] }, "properties": { "enter": { "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth", "offset":2}, "height": {"signal": "picHeight"}, "stroke": {"value":"#fff"},"strokeWidth": {"value":6} } } }, { // Draw a low-zoom locator map by using a premade world map image "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"url", "expr": "1" } ] }, "properties": { "enter": { "url": {"value": "wikirawupload:"}, "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth"}, "height": {"signal": "picHeight"} } } }, { // Draw a zoom-out mark at the [lan,lon] location "type": "symbol", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"lat", "expr": "imgLat" }, { "type": "formula", "field":"lon", "expr": "imgLon" }, { "type": "geo", "projection": "equirectangular", "scale": {"expr": "180/2/PI"}, "translate": [{"expr": "picXC"}, {"expr": "picYC"}], "center": [{"expr": "0"}, {"expr": "0"}], "lon": "lon", "lat": "lat" } ] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, "fill": {"value": "#c33"}, "stroke": {"value": "#ffe7e6"}, "size": {"value": 40} } } } ] } </graph> arc-angleA=-20 arc-gapA=3 arc-radiusA=0.8 |
opening bracket (reading up): <graph> { // // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:Street_map_with_marks // Please do not modify it anywhere else, as it may get copied and override your changes. // Suggestions can be made at https://www.mediawiki.org/wiki/Template_talk:Graph:Street_map_with_marks // // Template translation is in https://commons.wikimedia.org/wiki/Data:Original/Template:Graphs.tab // "version": 2, "width":200, "height": 150, "padding": 0, "signals":[ // These signals allow us to quickly move the map within the image, e.g. to leave space for the legend {"name":"legendWidth", "init": {"expr": "0"} }, {"name":"legendHeight", "init": {"expr": "height"} },
{"name":"imgWidth", "init": {"expr": "width-legendWidth"} },
{"name":"imgHeight", "init": {"expr": "height"} },
{"name":"imgXC", "init": {"expr": "imgWidth/2"} },
{"name":"imgYC", "init": {"expr": "imgHeight/2"} },
{"name":"imgTileSize", "init": {"expr": "256"} },
{"name":"imgLat", "init": {"expr": ""} },
{"name":"imgLon", "init": {"expr": "Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil)."} },
{"name":"imgZoom", "init": {"expr": "15"} },
{"name":"picWidth", "init": {"expr": "180"} },
{"name":"picHeight", "init": {"expr": "picWidth/2"} },
{"name":"picXC", "init": {"expr": "imgWidth-(picWidth/2)"} },
{"name":"picYC", "init": {"expr": "imgHeight-(picHeight/2)"} },
{"name":"showMiniMap", "init": {"expr": "0"} }
],
"data": [
{
"name": "data",
// Otherwise use the first unnamed argument for source values "values": [ { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"img": "wikirawupload:",
"width": 50,
"height": 8,
"offsetX": 63,
"offsetY": 57,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"width": 0,
"height": 0,
"size": 0,
"offsetX": 63,
"offsetY": 69,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": 0, "lon": 0, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
} , { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "o", "textAngle": -110, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "p", "textAngle": -107.48963926273, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "e", "textAngle": -104.97927852546, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "n", "textAngle": -102.46891778819, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "i", "textAngle": -99.958557050925, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "n", "textAngle": -97.448196313656, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "g", "textAngle": -94.937835576387, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -92.427474839118, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "b", "textAngle": -89.91711410185, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "r", "textAngle": -87.406753364581, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "a", "textAngle": -84.896392627312, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "c", "textAngle": -82.386031890043, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "k", "textAngle": -79.875671152774, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -72.344588940968, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "(", "textAngle": -69.834228203699, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "u", "textAngle": -67.32386746643, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}
"lat": 0.1, "lon": 0.1, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
}
], "transform": [ { "type": "geo", "projection": "mercator", "scale": {"expr": "imgTileSize/PI/2*pow(2,imgZoom)"}, "translate": [{"expr": "imgXC"}, {"expr": "imgYC"}], "center": [{"expr": "imgLon"}, {"expr": "imgLat"}], "lon": "lon", "lat": "lat" }, { "type": "formula", "field":"layout_x", "expr": "datum.layout_x + (datum.offsetX || 0)" }, { "type": "formula", "field":"layout_y", "expr": "datum.layout_y + (datum.offsetY || 0)" }, { "type": "formula", "field":"color", "expr": "datum.color || '#c33'" }, { "type": "formula", "field":"textColor", "expr": "datum.textColor || datum.color" }, { "type": "formula", "field":"strokeColor", "expr": "datum.strokeColor || '#ffe7e6'" } ] }, { // Hack: single value data source for drawing/hiding images and other non-series elements "name": "dummyData", "values": [{}] } ], // Legend only works if showLegend and colorScaleField are set "marks": [ { "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "formula", "field":"url", "expr": "'mapsnapshot:///?width='+imgWidth+'&height='+imgHeight+'&zoom='+imgZoom+'&lat='+imgLat+'&lon='+imgLon+'&lang=en'" } ] }, "properties": { "enter": { "url": {"field": "url"}, "xc": {"signal": "imgXC"}, "yc": {"signal": "imgYC"}, "width": {"signal": "imgWidth"}, "height": {"signal": "imgHeight"} } } }, { // Places an image of a given name and size at the [lan,lon] location "type": "image", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.img" }, { "type": "formula", "field":"iconWidth", "expr": "datum.width || 0" }, { "type": "formula", "field":"iconHeight", "expr": "datum.height || 0" }, { "type": "formula", "field":"img", "expr": "if(!test(/^[a-z]+:\\/\\//, datum.img), 'wikifile:///'+datum.img, datum.img)" }, // Ensure that either width or height parameter is passed to wikifile:// request { "type": "formula", "field":"img", "expr": "if((datum.iconWidth || datum.iconHeight) && !test(/[?&](width|height)=\\d/, datum.img),if(datum.iconWidth,datum.img+'?width='+datum.iconWidth,datum.img+'?height='+datum.iconHeight), datum.img)" } ]}, "properties": { "enter": { "url": {"field": "img"}, "xc": {"field": "layout_x"}, "yc": {"field": "layout_y"}, "width": {"field": "iconWidth"}, "height": {"field": "iconHeight"} } } }, { // Draw marks of a given color, shape, and size at the [lan,lon] location "type": "symbol", "from": { "data": "data", "transform": [{ "type": "filter", "test": "!datum.img" }] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, // If colorScaleField is set, use color scaling, otherwise use the preset color value "fill": { "field": "color" }, "size": {"field": "size"}, "shape": {"field": "shape"}, "stroke": {"field": "strokeColor"} } } }, { // Draw text with the given color and size at the [lan,lon] location // See https://github.com/vega/vega/wiki/Marks#text for all parameter description (prepend "text" and capitalize them) "type": "text", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.text" }, // Figure out if this is an LTR or RTL page. For LTR, show label to the right of the icon, left-aligned. For RTL, reverse. { "type": "formula", "field":"isLTR", "expr": "'' == '\\u200E'" }, // If these values are not defined ("undefined" is not allowed, so test for truthiness and not 0) { "type": "formula", "field":"textDx", "expr": "if(!datum.textDx && datum.textDx != 0, if(datum.isLTR,8,-8), datum.textDx)" }, { "type": "formula", "field":"textAlign", "expr": "if(!datum.textAlign, if(datum.isLTR,'left','right'), datum.textAlign)" }, { "type": "formula", "field":"textBaseline", "expr": "datum.textBaseline || 'middle'" } ]}, "properties": { "enter": { "text": {"field": "text"}, "x": {"field": "layout_x" }, "y": {"field": "layout_y"}, "dx": {"field": "textDx" }, "dy": {"field": "textDy"}, "fill": {"field": "textColor"}, "align": {"field": "textAlign"}, "baseline": {"field": "textBaseline"}, "radius": {"field": "textRadius"}, "theta": {"field": "textTheta"}, "angle": {"field": "textAngle"}, "font": {"field": "textFont"}, "fontSize": {"field": "textFontSize"}, "fontWeight": {"field": "textFontWeight"}, "fontStyle": {"field": "textFontStyle"} } } }, { // Draw a low-zoom locator map frame "type": "rect", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" } ] }, "properties": { "enter": { "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth", "offset":2}, "height": {"signal": "picHeight"}, "stroke": {"value":"#fff"},"strokeWidth": {"value":6} } } }, { // Draw a low-zoom locator map by using a premade world map image "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"url", "expr": "1" } ] }, "properties": { "enter": { "url": {"value": "wikirawupload:"}, "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth"}, "height": {"signal": "picHeight"} } } }, { // Draw a zoom-out mark at the [lan,lon] location "type": "symbol", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"lat", "expr": "imgLat" }, { "type": "formula", "field":"lon", "expr": "imgLon" }, { "type": "geo", "projection": "equirectangular", "scale": {"expr": "180/2/PI"}, "translate": [{"expr": "picXC"}, {"expr": "picYC"}], "center": [{"expr": "0"}, {"expr": "0"}], "lon": "lon", "lat": "lat" } ] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, "fill": {"value": "#c33"}, "stroke": {"value": "#ffe7e6"}, "size": {"value": 40} } } } ] } </graph> arc-angleA=-110 arc-gapA=1.5 arc-radiusA=0.6 |
opening bracket (reading down): <graph> { // // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:Street_map_with_marks // Please do not modify it anywhere else, as it may get copied and override your changes. // Suggestions can be made at https://www.mediawiki.org/wiki/Template_talk:Graph:Street_map_with_marks // // Template translation is in https://commons.wikimedia.org/wiki/Data:Original/Template:Graphs.tab // "version": 2, "width":200, "height": 200, "padding": 0, "signals":[ // These signals allow us to quickly move the map within the image, e.g. to leave space for the legend {"name":"legendWidth", "init": {"expr": "0"} }, {"name":"legendHeight", "init": {"expr": "height"} },
{"name":"imgWidth", "init": {"expr": "width-legendWidth"} },
{"name":"imgHeight", "init": {"expr": "height"} },
{"name":"imgXC", "init": {"expr": "imgWidth/2"} },
{"name":"imgYC", "init": {"expr": "imgHeight/2"} },
{"name":"imgTileSize", "init": {"expr": "256"} },
{"name":"imgLat", "init": {"expr": ""} },
{"name":"imgLon", "init": {"expr": "Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil)."} },
{"name":"imgZoom", "init": {"expr": "15"} },
{"name":"picWidth", "init": {"expr": "180"} },
{"name":"picHeight", "init": {"expr": "picWidth/2"} },
{"name":"picXC", "init": {"expr": "imgWidth-(picWidth/2)"} },
{"name":"picYC", "init": {"expr": "imgHeight-(picHeight/2)"} },
{"name":"showMiniMap", "init": {"expr": "0"} }
],
"data": [
{
"name": "data",
// Otherwise use the first unnamed argument for source values "values": [ { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"img": "wikirawupload:",
"width": 50,
"height": 8,
"offsetX": 63,
"offsetY": 82,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"width": 0,
"height": 0,
"size": 0,
"offsetX": 63,
"offsetY": 94,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": 0, "lon": 0, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
} , { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "o", "textAngle": -240, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "p", "textAngle": -243.34734843001, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "e", "textAngle": -246.69469686002, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "n", "textAngle": -250.04204529004, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "i", "textAngle": -253.38939372005, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "n", "textAngle": -256.73674215006, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "g", "textAngle": -260.08409058007, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -263.43143901008, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "b", "textAngle": -266.77878744009, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "r", "textAngle": -270.12613587011, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "a", "textAngle": -273.47348430012, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "c", "textAngle": -276.82083273013, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "k", "textAngle": -280.16818116014, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -290.21022645018, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "(", "textAngle": -293.55757488019, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "d", "textAngle": -296.9049233102, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}
"lat": 0.1, "lon": 0.1, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
}
], "transform": [ { "type": "geo", "projection": "mercator", "scale": {"expr": "imgTileSize/PI/2*pow(2,imgZoom)"}, "translate": [{"expr": "imgXC"}, {"expr": "imgYC"}], "center": [{"expr": "imgLon"}, {"expr": "imgLat"}], "lon": "lon", "lat": "lat" }, { "type": "formula", "field":"layout_x", "expr": "datum.layout_x + (datum.offsetX || 0)" }, { "type": "formula", "field":"layout_y", "expr": "datum.layout_y + (datum.offsetY || 0)" }, { "type": "formula", "field":"color", "expr": "datum.color || '#c33'" }, { "type": "formula", "field":"textColor", "expr": "datum.textColor || datum.color" }, { "type": "formula", "field":"strokeColor", "expr": "datum.strokeColor || '#ffe7e6'" } ] }, { // Hack: single value data source for drawing/hiding images and other non-series elements "name": "dummyData", "values": [{}] } ], // Legend only works if showLegend and colorScaleField are set "marks": [ { "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "formula", "field":"url", "expr": "'mapsnapshot:///?width='+imgWidth+'&height='+imgHeight+'&zoom='+imgZoom+'&lat='+imgLat+'&lon='+imgLon+'&lang=en'" } ] }, "properties": { "enter": { "url": {"field": "url"}, "xc": {"signal": "imgXC"}, "yc": {"signal": "imgYC"}, "width": {"signal": "imgWidth"}, "height": {"signal": "imgHeight"} } } }, { // Places an image of a given name and size at the [lan,lon] location "type": "image", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.img" }, { "type": "formula", "field":"iconWidth", "expr": "datum.width || 0" }, { "type": "formula", "field":"iconHeight", "expr": "datum.height || 0" }, { "type": "formula", "field":"img", "expr": "if(!test(/^[a-z]+:\\/\\//, datum.img), 'wikifile:///'+datum.img, datum.img)" }, // Ensure that either width or height parameter is passed to wikifile:// request { "type": "formula", "field":"img", "expr": "if((datum.iconWidth || datum.iconHeight) && !test(/[?&](width|height)=\\d/, datum.img),if(datum.iconWidth,datum.img+'?width='+datum.iconWidth,datum.img+'?height='+datum.iconHeight), datum.img)" } ]}, "properties": { "enter": { "url": {"field": "img"}, "xc": {"field": "layout_x"}, "yc": {"field": "layout_y"}, "width": {"field": "iconWidth"}, "height": {"field": "iconHeight"} } } }, { // Draw marks of a given color, shape, and size at the [lan,lon] location "type": "symbol", "from": { "data": "data", "transform": [{ "type": "filter", "test": "!datum.img" }] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, // If colorScaleField is set, use color scaling, otherwise use the preset color value "fill": { "field": "color" }, "size": {"field": "size"}, "shape": {"field": "shape"}, "stroke": {"field": "strokeColor"} } } }, { // Draw text with the given color and size at the [lan,lon] location // See https://github.com/vega/vega/wiki/Marks#text for all parameter description (prepend "text" and capitalize them) "type": "text", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.text" }, // Figure out if this is an LTR or RTL page. For LTR, show label to the right of the icon, left-aligned. For RTL, reverse. { "type": "formula", "field":"isLTR", "expr": "'' == '\\u200E'" }, // If these values are not defined ("undefined" is not allowed, so test for truthiness and not 0) { "type": "formula", "field":"textDx", "expr": "if(!datum.textDx && datum.textDx != 0, if(datum.isLTR,8,-8), datum.textDx)" }, { "type": "formula", "field":"textAlign", "expr": "if(!datum.textAlign, if(datum.isLTR,'left','right'), datum.textAlign)" }, { "type": "formula", "field":"textBaseline", "expr": "datum.textBaseline || 'middle'" } ]}, "properties": { "enter": { "text": {"field": "text"}, "x": {"field": "layout_x" }, "y": {"field": "layout_y"}, "dx": {"field": "textDx" }, "dy": {"field": "textDy"}, "fill": {"field": "textColor"}, "align": {"field": "textAlign"}, "baseline": {"field": "textBaseline"}, "radius": {"field": "textRadius"}, "theta": {"field": "textTheta"}, "angle": {"field": "textAngle"}, "font": {"field": "textFont"}, "fontSize": {"field": "textFontSize"}, "fontWeight": {"field": "textFontWeight"}, "fontStyle": {"field": "textFontStyle"} } } }, { // Draw a low-zoom locator map frame "type": "rect", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" } ] }, "properties": { "enter": { "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth", "offset":2}, "height": {"signal": "picHeight"}, "stroke": {"value":"#fff"},"strokeWidth": {"value":6} } } }, { // Draw a low-zoom locator map by using a premade world map image "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"url", "expr": "1" } ] }, "properties": { "enter": { "url": {"value": "wikirawupload:"}, "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth"}, "height": {"signal": "picHeight"} } } }, { // Draw a zoom-out mark at the [lan,lon] location "type": "symbol", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"lat", "expr": "imgLat" }, { "type": "formula", "field":"lon", "expr": "imgLon" }, { "type": "geo", "projection": "equirectangular", "scale": {"expr": "180/2/PI"}, "translate": [{"expr": "picXC"}, {"expr": "picYC"}], "center": [{"expr": "0"}, {"expr": "0"}], "lon": "lon", "lat": "lat" } ] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, "fill": {"value": "#c33"}, "stroke": {"value": "#ffe7e6"}, "size": {"value": 40} } } } ] } </graph> arc-angleA=-60 arc-gapA=-2 arc-radiusA=0.5 |
closing bracket (reading up): <graph> { // // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:Street_map_with_marks // Please do not modify it anywhere else, as it may get copied and override your changes. // Suggestions can be made at https://www.mediawiki.org/wiki/Template_talk:Graph:Street_map_with_marks // // Template translation is in https://commons.wikimedia.org/wiki/Data:Original/Template:Graphs.tab // "version": 2, "width":200, "height": 200, "padding": 0, "signals":[ // These signals allow us to quickly move the map within the image, e.g. to leave space for the legend {"name":"legendWidth", "init": {"expr": "0"} }, {"name":"legendHeight", "init": {"expr": "height"} },
{"name":"imgWidth", "init": {"expr": "width-legendWidth"} },
{"name":"imgHeight", "init": {"expr": "height"} },
{"name":"imgXC", "init": {"expr": "imgWidth/2"} },
{"name":"imgYC", "init": {"expr": "imgHeight/2"} },
{"name":"imgTileSize", "init": {"expr": "256"} },
{"name":"imgLat", "init": {"expr": ""} },
{"name":"imgLon", "init": {"expr": "Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil)."} },
{"name":"imgZoom", "init": {"expr": "15"} },
{"name":"picWidth", "init": {"expr": "180"} },
{"name":"picHeight", "init": {"expr": "picWidth/2"} },
{"name":"picXC", "init": {"expr": "imgWidth-(picWidth/2)"} },
{"name":"picYC", "init": {"expr": "imgHeight-(picHeight/2)"} },
{"name":"showMiniMap", "init": {"expr": "0"} }
],
"data": [
{
"name": "data",
// Otherwise use the first unnamed argument for source values "values": [ { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"img": "wikirawupload:",
"width": 50,
"height": 8,
"offsetX": 63,
"offsetY": 82,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"width": 0,
"height": 0,
"size": 0,
"offsetX": 63,
"offsetY": 94,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": 0, "lon": 0, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
} , { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "c", "textAngle": -60, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "l", "textAngle": -62.510056037092, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "o", "textAngle": -65.020112074184, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "s", "textAngle": -67.530168111277, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "i", "textAngle": -70.040224148369, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "n", "textAngle": -72.550280185461, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "g", "textAngle": -75.060336222553, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -77.570392259645, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "b", "textAngle": -80.080448296738, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "r", "textAngle": -82.59050433383, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "a", "textAngle": -85.100560370922, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "c", "textAngle": -87.610616408014, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "k", "textAngle": -90.120672445106, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": -97.650840556383, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "(", "textAngle": -100.16089659348, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "u", "textAngle": -102.67095263057, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}
"lat": 0.1, "lon": 0.1, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
}
], "transform": [ { "type": "geo", "projection": "mercator", "scale": {"expr": "imgTileSize/PI/2*pow(2,imgZoom)"}, "translate": [{"expr": "imgXC"}, {"expr": "imgYC"}], "center": [{"expr": "imgLon"}, {"expr": "imgLat"}], "lon": "lon", "lat": "lat" }, { "type": "formula", "field":"layout_x", "expr": "datum.layout_x + (datum.offsetX || 0)" }, { "type": "formula", "field":"layout_y", "expr": "datum.layout_y + (datum.offsetY || 0)" }, { "type": "formula", "field":"color", "expr": "datum.color || '#c33'" }, { "type": "formula", "field":"textColor", "expr": "datum.textColor || datum.color" }, { "type": "formula", "field":"strokeColor", "expr": "datum.strokeColor || '#ffe7e6'" } ] }, { // Hack: single value data source for drawing/hiding images and other non-series elements "name": "dummyData", "values": [{}] } ], // Legend only works if showLegend and colorScaleField are set "marks": [ { "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "formula", "field":"url", "expr": "'mapsnapshot:///?width='+imgWidth+'&height='+imgHeight+'&zoom='+imgZoom+'&lat='+imgLat+'&lon='+imgLon+'&lang=en'" } ] }, "properties": { "enter": { "url": {"field": "url"}, "xc": {"signal": "imgXC"}, "yc": {"signal": "imgYC"}, "width": {"signal": "imgWidth"}, "height": {"signal": "imgHeight"} } } }, { // Places an image of a given name and size at the [lan,lon] location "type": "image", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.img" }, { "type": "formula", "field":"iconWidth", "expr": "datum.width || 0" }, { "type": "formula", "field":"iconHeight", "expr": "datum.height || 0" }, { "type": "formula", "field":"img", "expr": "if(!test(/^[a-z]+:\\/\\//, datum.img), 'wikifile:///'+datum.img, datum.img)" }, // Ensure that either width or height parameter is passed to wikifile:// request { "type": "formula", "field":"img", "expr": "if((datum.iconWidth || datum.iconHeight) && !test(/[?&](width|height)=\\d/, datum.img),if(datum.iconWidth,datum.img+'?width='+datum.iconWidth,datum.img+'?height='+datum.iconHeight), datum.img)" } ]}, "properties": { "enter": { "url": {"field": "img"}, "xc": {"field": "layout_x"}, "yc": {"field": "layout_y"}, "width": {"field": "iconWidth"}, "height": {"field": "iconHeight"} } } }, { // Draw marks of a given color, shape, and size at the [lan,lon] location "type": "symbol", "from": { "data": "data", "transform": [{ "type": "filter", "test": "!datum.img" }] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, // If colorScaleField is set, use color scaling, otherwise use the preset color value "fill": { "field": "color" }, "size": {"field": "size"}, "shape": {"field": "shape"}, "stroke": {"field": "strokeColor"} } } }, { // Draw text with the given color and size at the [lan,lon] location // See https://github.com/vega/vega/wiki/Marks#text for all parameter description (prepend "text" and capitalize them) "type": "text", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.text" }, // Figure out if this is an LTR or RTL page. For LTR, show label to the right of the icon, left-aligned. For RTL, reverse. { "type": "formula", "field":"isLTR", "expr": "'' == '\\u200E'" }, // If these values are not defined ("undefined" is not allowed, so test for truthiness and not 0) { "type": "formula", "field":"textDx", "expr": "if(!datum.textDx && datum.textDx != 0, if(datum.isLTR,8,-8), datum.textDx)" }, { "type": "formula", "field":"textAlign", "expr": "if(!datum.textAlign, if(datum.isLTR,'left','right'), datum.textAlign)" }, { "type": "formula", "field":"textBaseline", "expr": "datum.textBaseline || 'middle'" } ]}, "properties": { "enter": { "text": {"field": "text"}, "x": {"field": "layout_x" }, "y": {"field": "layout_y"}, "dx": {"field": "textDx" }, "dy": {"field": "textDy"}, "fill": {"field": "textColor"}, "align": {"field": "textAlign"}, "baseline": {"field": "textBaseline"}, "radius": {"field": "textRadius"}, "theta": {"field": "textTheta"}, "angle": {"field": "textAngle"}, "font": {"field": "textFont"}, "fontSize": {"field": "textFontSize"}, "fontWeight": {"field": "textFontWeight"}, "fontStyle": {"field": "textFontStyle"} } } }, { // Draw a low-zoom locator map frame "type": "rect", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" } ] }, "properties": { "enter": { "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth", "offset":2}, "height": {"signal": "picHeight"}, "stroke": {"value":"#fff"},"strokeWidth": {"value":6} } } }, { // Draw a low-zoom locator map by using a premade world map image "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"url", "expr": "1" } ] }, "properties": { "enter": { "url": {"value": "wikirawupload:"}, "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth"}, "height": {"signal": "picHeight"} } } }, { // Draw a zoom-out mark at the [lan,lon] location "type": "symbol", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"lat", "expr": "imgLat" }, { "type": "formula", "field":"lon", "expr": "imgLon" }, { "type": "geo", "projection": "equirectangular", "scale": {"expr": "180/2/PI"}, "translate": [{"expr": "picXC"}, {"expr": "picYC"}], "center": [{"expr": "0"}, {"expr": "0"}], "lon": "lon", "lat": "lat" } ] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, "fill": {"value": "#c33"}, "stroke": {"value": "#ffe7e6"}, "size": {"value": 40} } } } ] } </graph> arc-angleA=120 arc-gapA=-1.5 arc-radiusA=0.8 |
closing bracket (reading down): <graph> { // // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:Street_map_with_marks // Please do not modify it anywhere else, as it may get copied and override your changes. // Suggestions can be made at https://www.mediawiki.org/wiki/Template_talk:Graph:Street_map_with_marks // // Template translation is in https://commons.wikimedia.org/wiki/Data:Original/Template:Graphs.tab // "version": 2, "width":200, "height": 200, "padding": 0, "signals":[ // These signals allow us to quickly move the map within the image, e.g. to leave space for the legend {"name":"legendWidth", "init": {"expr": "0"} }, {"name":"legendHeight", "init": {"expr": "height"} },
{"name":"imgWidth", "init": {"expr": "width-legendWidth"} },
{"name":"imgHeight", "init": {"expr": "height"} },
{"name":"imgXC", "init": {"expr": "imgWidth/2"} },
{"name":"imgYC", "init": {"expr": "imgHeight/2"} },
{"name":"imgTileSize", "init": {"expr": "256"} },
{"name":"imgLat", "init": {"expr": ""} },
{"name":"imgLon", "init": {"expr": "Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil)."} },
{"name":"imgZoom", "init": {"expr": "15"} },
{"name":"picWidth", "init": {"expr": "180"} },
{"name":"picHeight", "init": {"expr": "picWidth/2"} },
{"name":"picXC", "init": {"expr": "imgWidth-(picWidth/2)"} },
{"name":"picYC", "init": {"expr": "imgHeight-(picHeight/2)"} },
{"name":"showMiniMap", "init": {"expr": "0"} }
],
"data": [
{
"name": "data",
// Otherwise use the first unnamed argument for source values "values": [ { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"img": "wikirawupload:",
"width": 50,
"height": 8,
"offsetX": 63,
"offsetY": 82,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": ,
"lon": Lua error in mw.text.lua at line 219: bad argument #1 to 'len' (string expected, got nil).,
"width": 0,
"height": 0,
"size": 0,
"offsetX": 63,
"offsetY": 94,
"textAlign": "right",
"textDx": 22,
"textDy": -2,
"textColor": "grey",
"textFont": "Tahoma",
"textFontSize": 9,
"text": "Expression error: Unexpected < operator." }
, { "lat": 0, "lon": 0, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
} , { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "c", "textAngle": 60, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "l", "textAngle": 64.184434551362, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "o", "textAngle": 68.368869102724, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "s", "textAngle": 72.553303654086, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "i", "textAngle": 76.737738205448, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "n", "textAngle": 80.922172756811, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "g", "textAngle": 85.106607308173, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": 89.291041859535, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "b", "textAngle": 93.475476410897, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "r", "textAngle": 97.659910962259, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "a", "textAngle": 101.84434551362, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "c", "textAngle": 106.02878006498, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "k", "textAngle": 110.21321461635, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "", "textAngle": 122.76651827043, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "(", "textAngle": 126.95095282179, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}, { "lat": Expression error: Unexpected < operator., "lon": Expression error: Unexpected < operator., "size": "0", "text": "d", "textAngle": 131.13538737316, "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 12, "textColor": "#222211"
}
"lat": 0.1, "lon": 0.1, "img": "wikirawupload:", "height": 10, "width": 10, "text": "", "textAngle": 0, "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 1, "textFontSize": 12, "textColor": "#222211"
}
], "transform": [ { "type": "geo", "projection": "mercator", "scale": {"expr": "imgTileSize/PI/2*pow(2,imgZoom)"}, "translate": [{"expr": "imgXC"}, {"expr": "imgYC"}], "center": [{"expr": "imgLon"}, {"expr": "imgLat"}], "lon": "lon", "lat": "lat" }, { "type": "formula", "field":"layout_x", "expr": "datum.layout_x + (datum.offsetX || 0)" }, { "type": "formula", "field":"layout_y", "expr": "datum.layout_y + (datum.offsetY || 0)" }, { "type": "formula", "field":"color", "expr": "datum.color || '#c33'" }, { "type": "formula", "field":"textColor", "expr": "datum.textColor || datum.color" }, { "type": "formula", "field":"strokeColor", "expr": "datum.strokeColor || '#ffe7e6'" } ] }, { // Hack: single value data source for drawing/hiding images and other non-series elements "name": "dummyData", "values": [{}] } ], // Legend only works if showLegend and colorScaleField are set "marks": [ { "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "formula", "field":"url", "expr": "'mapsnapshot:///?width='+imgWidth+'&height='+imgHeight+'&zoom='+imgZoom+'&lat='+imgLat+'&lon='+imgLon+'&lang=en'" } ] }, "properties": { "enter": { "url": {"field": "url"}, "xc": {"signal": "imgXC"}, "yc": {"signal": "imgYC"}, "width": {"signal": "imgWidth"}, "height": {"signal": "imgHeight"} } } }, { // Places an image of a given name and size at the [lan,lon] location "type": "image", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.img" }, { "type": "formula", "field":"iconWidth", "expr": "datum.width || 0" }, { "type": "formula", "field":"iconHeight", "expr": "datum.height || 0" }, { "type": "formula", "field":"img", "expr": "if(!test(/^[a-z]+:\\/\\//, datum.img), 'wikifile:///'+datum.img, datum.img)" }, // Ensure that either width or height parameter is passed to wikifile:// request { "type": "formula", "field":"img", "expr": "if((datum.iconWidth || datum.iconHeight) && !test(/[?&](width|height)=\\d/, datum.img),if(datum.iconWidth,datum.img+'?width='+datum.iconWidth,datum.img+'?height='+datum.iconHeight), datum.img)" } ]}, "properties": { "enter": { "url": {"field": "img"}, "xc": {"field": "layout_x"}, "yc": {"field": "layout_y"}, "width": {"field": "iconWidth"}, "height": {"field": "iconHeight"} } } }, { // Draw marks of a given color, shape, and size at the [lan,lon] location "type": "symbol", "from": { "data": "data", "transform": [{ "type": "filter", "test": "!datum.img" }] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, // If colorScaleField is set, use color scaling, otherwise use the preset color value "fill": { "field": "color" }, "size": {"field": "size"}, "shape": {"field": "shape"}, "stroke": {"field": "strokeColor"} } } }, { // Draw text with the given color and size at the [lan,lon] location // See https://github.com/vega/vega/wiki/Marks#text for all parameter description (prepend "text" and capitalize them) "type": "text", "from": { "data": "data", "transform": [ { "type": "filter", "test": "datum.text" }, // Figure out if this is an LTR or RTL page. For LTR, show label to the right of the icon, left-aligned. For RTL, reverse. { "type": "formula", "field":"isLTR", "expr": "'' == '\\u200E'" }, // If these values are not defined ("undefined" is not allowed, so test for truthiness and not 0) { "type": "formula", "field":"textDx", "expr": "if(!datum.textDx && datum.textDx != 0, if(datum.isLTR,8,-8), datum.textDx)" }, { "type": "formula", "field":"textAlign", "expr": "if(!datum.textAlign, if(datum.isLTR,'left','right'), datum.textAlign)" }, { "type": "formula", "field":"textBaseline", "expr": "datum.textBaseline || 'middle'" } ]}, "properties": { "enter": { "text": {"field": "text"}, "x": {"field": "layout_x" }, "y": {"field": "layout_y"}, "dx": {"field": "textDx" }, "dy": {"field": "textDy"}, "fill": {"field": "textColor"}, "align": {"field": "textAlign"}, "baseline": {"field": "textBaseline"}, "radius": {"field": "textRadius"}, "theta": {"field": "textTheta"}, "angle": {"field": "textAngle"}, "font": {"field": "textFont"}, "fontSize": {"field": "textFontSize"}, "fontWeight": {"field": "textFontWeight"}, "fontStyle": {"field": "textFontStyle"} } } }, { // Draw a low-zoom locator map frame "type": "rect", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" } ] }, "properties": { "enter": { "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth", "offset":2}, "height": {"signal": "picHeight"}, "stroke": {"value":"#fff"},"strokeWidth": {"value":6} } } }, { // Draw a low-zoom locator map by using a premade world map image "type": "image", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"url", "expr": "1" } ] }, "properties": { "enter": { "url": {"value": "wikirawupload:"}, "xc": {"signal": "picXC"}, "yc": {"signal": "picYC"}, "width": {"signal": "picWidth"}, "height": {"signal": "picHeight"} } } }, { // Draw a zoom-out mark at the [lan,lon] location "type": "symbol", "from": { "data": "dummyData", "transform": [ { "type": "filter", "test": "showMiniMap" }, { "type": "formula", "field":"lat", "expr": "imgLat" }, { "type": "formula", "field":"lon", "expr": "imgLon" }, { "type": "geo", "projection": "equirectangular", "scale": {"expr": "180/2/PI"}, "translate": [{"expr": "picXC"}, {"expr": "picYC"}], "center": [{"expr": "0"}, {"expr": "0"}], "lon": "lon", "lat": "lat" } ] }, "properties": { "enter": { "x": {"field": "layout_x"}, "y": {"field": "layout_y"}, "fill": {"value": "#c33"}, "stroke": {"value": "#ffe7e6"}, "size": {"value": 40} } } } ] } </graph> arc-angleA=60 arc-gapA=2.5 arc-radiusA=0.4 |