تضامنًا مع حق الشعب الفلسطيني |
قالب:OSM Location map/ملعب
<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,"lang": "ar", "width":350, "height": 250, "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": "0"} }, {"name":"imgLon", "init": {"expr": "0"} }, {"name":"imgZoom", "init": {"expr": "0"} }, {"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": 0, "lon": 0, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Mapscaleline.svg/120px-Mapscaleline.svg.png", "width": 50, "height": 8, "offsetX": 138, "offsetY": 115, "textAlign": "right", "textDx": 22, "textDy": -2, "textColor": "grey", "textFont": "Tahoma", "textFontSize": 9, "text": "10 000km" } , { "lat": 0, "lon": 0, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/10px-Red_pog.svg.png", "height": 10, "width": 10, "text": "", "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 0+1, "textFontSize": 10
}
], "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" } ] }, "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> |
هذه صفحة ملعب القالب لصفحة قالب:OSM Location map (فرق). انظر أيضاً الصفحات الفرعية لـ مختبر. |
<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,"lang": "ar", "width":300, "height": 300, "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": "52.6909"} }, {"name":"imgLon", "init": {"expr": "-1.2163"} }, {"name":"imgZoom", "init": {"expr": "13"} }, {"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": 52.6909, "lon": -1.2163, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/7/75/White_square.gif", "width": 82, "height": 62, "offsetX": 109, "offsetY": 119 }, { "lat": 52.6909, "lon": -1.2163, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Leicestershire_UK_district_map_%28blank%29.svg/80px-Leicestershire_UK_district_map_%28blank%29.svg.png", "width": 80, "height": 60, "offsetX": 110, "offsetY": 120 }, { "lat": 52.6909, "lon": -1.2163, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/6px-Red_pog.svg.png", "width": 6, "offsetX": 107, "offsetY": 117 }, { "lat": 52.6909, "lon": -1.2163, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Mapscaleline.svg/120px-Mapscaleline.svg.png", "width": 50, "height": 8, "offsetX": 39, "offsetY": 140, "textAlign": "right", "textDx": 22, "textDy": -2, "textColor": "grey", "textFont": "Tahoma", "textFontSize": 9, "text": "1km" } , { "lat": 52.69632, "lon": -1.22391, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/11px-Red_pog.svg.png", "height": 11, "width": 11, "text": "Old John Tower", "textAlign": "left", "textBaseline": "middle", "textDx": 7, "textDy": 0+1, "textFontSize": 13, "textColor": "black"
} , { "lat": 52.694944, "lon": -1.2254584, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/7px-Red_pog.svg.png", "height": 7, "width": 7, "text": "War memorial", "textAlign": "right", "textBaseline": "middle", "textDx": -5, "textDy": 0+1, "textFontSize": 9, "textColor": "black"
} , { "lat": 52.6909, "lon": -1.2163, "size": "0", "text": "BRADGATE PARK", "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -2, "textFontSize": 9, "textColor": "black"
} , { "lat": 52.686698, "lon": -1.2111676, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/7px-Red_pog.svg.png", "height": 7, "width": 7, "text": "Bradgate", "textAlign": "center", "textBaseline": "top", "textDx": 0, "textDy": 5, "textFontSize": 9, "textColor": "black" }, { "lat": 52.686698, "lon": -1.2111676, "shape": "circle", "size": "0", "text": "House", "textAlign": "center", "textBaseline": "top", "textDx": 0, "textDy": 15, "textFontSize": 9, "textColor": "black"
"shape": "circle", "size": "0", "text": "Reservoir", "textAngle": -38, "textAlign": "center", "textBaseline": "top", "textDx": 0, "textDy": 12, "textFontSize": 9, "textColor": "blue"
"shape": "circle", "size": "0", "text": "(Hunt's Hill)", "textAlign": "left", "textBaseline": "middle", "textDx": 7, "textDy": 11, "textFontSize": 9, "textColor": "black"
} , { "lat": 52.68356, "lon": -1.2277007, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/BSicon_PARKING.svg/11px-BSicon_PARKING.svg.png", "height": 11, "width": 11, "text": "", "textAlign": "center", "textBaseline": "top", "textDx": 0, "textDy": 7, "textFontSize": 9, "textColor": "black"
}
], "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" } ] }, "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> |
Old John Tower in متنزه برادجيت, Leicestershire |
This template provides a map in a frame, for any location and scale. At its simplest it can simply show the Open Street Map image and a scale indicator for a given area of land. Optionally a range of marker, label and annotation tools are available to include location markers, labels, numbered dots, a heading, caption, mini-locator map and overlays. The map also provides a link to a full-screen interactive 'maplink' version.
Purpose
OSM Location map allows an editor to include a map in a frame for anywhere in the world, at any scale from the whole world down two one or two streets. It makes use of the Open Street Map mapping data, and enables a place-based page or topic to simply show the area being described, without the need for pre-determined map templates. The underlying map will be updated and improved automatically as the OSM data develops.
The template can also show multiple marks, images and labels (currently limited to ten). The template makes use of {{Graph:Street map with marks}}, which allows unlimited numbers of marks and labels, utilises a different coding mark-up, and is particularly suited to using data directly from a ويكي بيانات source.
The resulting framed map also has a link to a full-screen version, which opens at the same location, above the current page. This has a richer map interface, can be re-scaled and panned by the user, has optional thumbnail images and captions for the marker points, and can also access a wide range of maps, satellite images etc. (The fullscreen option uses the <maplink> mapping provision.)
A rough guide to the scale of the map is provided in the bottom left corner. This is only a guide, as the projection means the scale changes depending on the latitude. Some allowance has been made for this, but only in large 20 degree chunks.
<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,"lang": "ar", "width":350, "height": 250, "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": "53.41459"} }, {"name":"imgLon", "init": {"expr": "-4.3341279"} }, {"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": 53.41459, "lon": -4.3341279, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Mapscaleline.svg/120px-Mapscaleline.svg.png", "width": 50, "height": 8, "offsetX": 138, "offsetY": 115, "textAlign": "right", "textDx": 22, "textDy": -2, "textColor": "grey", "textFont": "Tahoma", "textFontSize": 9, "text": "200m" } , { "lat": 0, "lon": 0, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/10px-Red_pog.svg.png", "height": 10, "width": 10, "text": "", "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 0+1, "textFontSize": 10
}
], "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" } ] }, "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> |
الاستخدام
- Minimal version
- an unadorned map centred on a latitude and longitiude coordinates, via a {{إحداثيات}} value. Set the zoom to give a scale that fits the subject (0=whole world, 18=a street). With just these options set, all other parameters use the defaults, or are left unused. It gives a link to the full screen version.
{{OSM Location map <!--These parameters are the only essential items--> | coord = {{إحداثيات|53.41459|-4.3341279}} <!--latitude and longitude - eg as a +/- decimal. --> | zoom = 15 <!--(1=whole world, 18=a street)--> }} |
- Single marker
- Using mostly default settings, with a Red pog marker and label, and some additional info for use on the full screen version.
<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,"lang": "ar", "width":300, "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": "53.394"} }, {"name":"imgLon", "init": {"expr": "-4.450"} }, {"name":"imgZoom", "init": {"expr": "13"} }, {"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": 53.394, "lon": -4.450, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Mapscaleline.svg/120px-Mapscaleline.svg.png", "width": 50, "height": 8, "offsetX": 113, "offsetY": 65, "textAlign": "right", "textDx": 22, "textDy": -2, "textColor": "grey", "textFont": "Tahoma", "textFontSize": 9, "text": "1km" } , { "lat": 53.3966, "lon": -4.46204, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/10px-Red_pog.svg.png", "height": 10, "width": 10, "text": "Llanfechell Triangle", "textAlign": "left", "textBaseline": "middle", "textDx": 7, "textDy": 0+1, "textFontSize": 10
}
], "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" } ] }, "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> |
The 'Llanfechell Triangle' standing stones are north-west of لانفيتشيل (أنغلزي). |
{{OSM Location map | coord = {{إحداثيات| | }} <!-- {{إحداثيات}} has various formats for latitude and longitude --> | zoom = <!-- (1=whole world, 18=a street)--> | width = <!-- width and height of the frame. numeric input - do not add px --> | height = | caption = <!-- Text below the map. Can include [[رابط تشعبي]] --> | mark-coord = <!-- use {{إحداثيات| | }} to set lat and lon location for the marker --> | label = <!-- text alongside the mark --> | label-pos = <!--default position is to the left. (or right, top, bottom)--> | mark-title = <!-- | --> | mark-image = <!-- | these are only used within the full screen linked page --> | mark-description = <!-- | --> }} |
<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,"lang": "ar", "width":300, "height": 250, "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": "53.395"} }, {"name":"imgLon", "init": {"expr": "-4.452"} }, {"name":"imgZoom", "init": {"expr": "14"} }, {"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": 53.395, "lon": -4.452, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/7/75/White_square.gif", "width": 72, "height": 92, "offsetX": 114, "offsetY": 79 }, { "lat": 53.395, "lon": -4.452, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/7/73/Wales_relief_location_map.jpg/70px-Wales_relief_location_map.jpg", "width": 70, "height": 90, "offsetX": 115, "offsetY": 80 }, { "lat": 53.395, "lon": -4.452, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/6px-Red_pog.svg.png", "width": 6, "offsetX": 105, "offsetY": 39 }, { "lat": 53.395, "lon": -4.452, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Mapscaleline.svg/120px-Mapscaleline.svg.png", "width": 50, "height": 8, "offsetX": 48, "offsetY": 115, "textAlign": "right", "textDx": 22, "textDy": -2, "textColor": "grey", "textFont": "Tahoma", "textFontSize": 9, "text": "500m" } , { "lat": 0, "lon": 0, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/10px-Red_pog.svg.png", "height": 10, "width": 10, "text": "", "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 0+1, "textFontSize": 10
} , { "lat": 53.3964, "lon": -4.4531, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/10px-Red_pog.svg.png", "height": 10, "width": 10, "text": "Baron Hill Maen Hir", "textAlign": "left", "textBaseline": "middle", "textDx": 7, "textDy": 0+1, "textFontSize": 11
} , { "lat": 53.3966, "lon": -4.46204, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/10px-Red_pog.svg.png", "height": 10, "width": 10, "text": "Llanfechell Triangle", "textAlign": "center", "textBaseline": "bottom", "textDx": 35, "textDy": -7, "textFontSize": 11
}
], "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" } ] }, "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> |
Scheduled monuments around لانفيتشيل (أنغلزي)، أنغلزي |
<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,"lang": "ar", "width":300, "height": 300, "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": "52.0"} }, {"name":"imgLon", "init": {"expr": "-4.810"} }, {"name":"imgZoom", "init": {"expr": "11"} }, {"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": 52.0, "lon": -4.810, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Mapscaleline.svg/120px-Mapscaleline.svg.png", "width": 50, "height": 8, "offsetX": 67, "offsetY": 140, "textAlign": "right", "textDx": 22, "textDy": -2, "textColor": "grey", "textFont": "Tahoma", "textFontSize": 9, "text": "3km" } , { "lat": 51.9990, "lon": -4.7700, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Archaeological_site_icon_%28red%29.svg/14px-Archaeological_site_icon_%28red%29.svg.png", "height": 14, "width": 14, "text": "Pentre Ifan", "textAlign": "right", "textBaseline": "middle", "textDx": -9, "textDy": 0+1, "textFontSize": 15, "textColor": "black"
} , { "lat": 52.0545, "lon": -4.7717, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Archaeological_site_icon_%28red%29.svg/9px-Archaeological_site_icon_%28red%29.svg.png", "height": 9, "width": 9, "text": "Llech-y-Tribedd dolmen", "textAlign": "right", "textBaseline": "middle", "textDx": -6, "textDy": 0+1, "textFontSize": 10, "textColor": "grey"
} , { "lat": 52.0186, "lon": -4.8282, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Archaeological_site_icon_%28red%29.svg/9px-Archaeological_site_icon_%28red%29.svg.png", "height": 9, "width": 9, "text": "Carreg Coetan", "textAlign": "center", "textBaseline": "bottom", "textDx": -6, "textDy": -17, "textFontSize": 10, "textColor": "grey" }, { "lat": 52.0186, "lon": -4.8282, "shape": "circle", "size": "0", "text": "Arthur dolmen", "textAlign": "center", "textBaseline": "bottom", "textDx": -6, "textDy": -6, "textFontSize": 10, "textColor": "grey"
"shape": "circle", "size": "0", "text": "Neolithic enclosure", "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -6, "textFontSize": 10, "textColor": "grey"
"shape": "circle", "size": "0", "text": "Burial Chamber", "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -6, "textFontSize": 10, "textColor": "grey"
} , { "lat": 52.0478, "lon": -4.7982, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Archaeological_site_icon_%28red%29.svg/9px-Archaeological_site_icon_%28red%29.svg.png", "height": 9, "width": 9, "text": "Trellyffaint dolmen", "textAlign": "left", "textBaseline": "middle", "textDx": 6, "textDy": 0+1, "textFontSize": 10, "textColor": "grey"
} , { "lat": 52.0137, "lon": -4.8627, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Archaeological_site_icon_%28red%29.svg/9px-Archaeological_site_icon_%28red%29.svg.png", "height": 9, "width": 9, "text": "Cerig-y-Gof", "textAlign": "center", "textBaseline": "top", "textDx": 10, "textDy": 6, "textFontSize": 10, "textColor": "grey" }, { "lat": 52.0137, "lon": -4.8627, "shape": "circle", "size": "0", "text": "chambered tomb", "textAlign": "center", "textBaseline": "top", "textDx": 10, "textDy": 17, "textFontSize": 10, "textColor": "grey"
} , { "lat": 51.973, "lon": -4.77, "size": "0", "text": "P R E S E L I H I L L S", "textAngle": 25, "textAlign": "right", "textBaseline": "middle", "textDx": -2, "textDy": 0+1, "textFontSize": 10, "textColor": "green"
}
], "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" } ] }, "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> |
Pentre Ifan and other nearby Neolithic sites |
Multiple markers, labels and/or images
In addition to the un-numbered mark parameters there are 9 numbered ones. These are otherwise identical to the one above, but each mark and label has its own set of parameters (mark1, mark-coord1, label1, label-pos1 etc...mark2, mark-coord2, label2, label-pos2 etc.) Mark1 acts as a 'master marker' for many parameters. Values given to the mark1 set are inherited by the other numbered sets, which avoids some repetition.
Minimap
There is a built-in map of the world option, which will act as a mini locator map and automatically adds a red locator dot. Unfortunately it is too general for most purposes, so making use of an existing 'Location map' file is possible. This is not very automated. The width and height of the map both have to be specified (and it is up to you to not distort the map dimensions). An optional locator dot can be placed by specifying the minipog-x and -y values, using the same scale values as mini-width and -height. With an origin in the top left of the minimap, the minipog can be placed over the relevant point on the minimap.
| minimap = file <!--this minimap is used in the example to the right--> | mini-file = Wales relief location map.jpg | mini-width = 70 | mini-height = 90 | minipog-x = 25 | minipog-y = 4 | scalemark = 66 <!-- shifts the scalemark further to the left -->
Alternative marks
Instead of using the standard 'Red pog' for mark points on the map, other images can be used. Any image from Wikimedia Commons can be specified. The example on the right uses 'Archaeological site icon (red).svg'. If a particular file is specified in mark1=
, all subsequent marks will use it unless they name their own image file. If the image is not square, a dimension value also needs to be set (width ratio for a height of 1)
<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,"lang": "ar", "width":300, "height": 300, "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": "52.6328"} }, {"name":"imgLon", "init": {"expr": "-1.138"} }, {"name":"imgZoom", "init": {"expr": "14"} }, {"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": 52.6328, "lon": -1.138, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/7/75/White_square.gif", "width": 102, "height": 77, "offsetX": 99, "offsetY": 111.5 }, { "lat": 52.6328, "lon": -1.138, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Leicestershire_UK_district_map_%28blank%29.svg/100px-Leicestershire_UK_district_map_%28blank%29.svg.png", "width": 100, "height": 75, "offsetX": 100, "offsetY": 112.5 }, { "lat": 52.6328, "lon": -1.138, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/6px-Red_pog.svg.png", "width": 6, "offsetX": 102, "offsetY": 114 }, { "lat": 52.6328, "lon": -1.138, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Mapscaleline.svg/120px-Mapscaleline.svg.png", "width": 50, "height": 8, "offsetX": 8, "offsetY": 140, "textAlign": "right", "textDx": 22, "textDy": -2, "textColor": "grey", "textFont": "Tahoma", "textFontSize": 9, "text": "500m" } , { "lat": 52.6328, "lon": -1.1380, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/8/8f/Leicester_Town_Walls_map_overlay.svg/240px-Leicester_Town_Walls_map_overlay.svg.png", "height": 300, "width": 240, "text": "", "textAlign": "right", "textBaseline": "middle", "textDx": -122, "textDy": 0+1, "textFontSize": 10
} , { "lat": 52.632333, "lon": -1.141194, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/11px-Red_pog.svg.png", "height": 11, "width": 11, "text": "Leicester Castle", "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 0+1, "textFontSize": 10
}
], "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" } ] }, "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> |
Leicester Castle and the line of the medieval town walls |
Text effects
Where label text is too long to fit on a single line, two further label line can be used: labela =
and labelb =
.
It is possible to specify a label-angle =
, which will pivot the label text around the centre of the marker point by the specified angle. If mark-size is set to zero, this has the effect of a free-floating label with no marker, useful for various geographic and linear features. (This is illustrated by the 'Preseli Hills' text on the Pentre Ifan map)
Transparent overlay
The specified image file can be any size. Using an .svg image with a transparent background, and annotations that match the scale and location of the base map, it is possible to provide a customised overlay image to show particular features that are not included on the base map. The line of the town walls on the map of Leicester are arrived at by that means.
Numbered dots
<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,"lang": "ar", "width":200, "height": 300, "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": "52.620"} }, {"name":"imgLon", "init": {"expr": "-1.112"} }, {"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": 52.620, "lon": -1.112, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Mapscaleline.svg/120px-Mapscaleline.svg.png", "width": 50, "height": 8, "offsetX": 63, "offsetY": 140, "textAlign": "right", "textDx": 22, "textDy": -2, "textColor": "grey", "textFont": "Tahoma", "textFontSize": 9, "text": "200m" } , { "lat": 0, "lon": 0, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Red_pog.svg/10px-Red_pog.svg.png", "height": 10, "width": 10, "text": "", "textAlign": "right", "textBaseline": "middle", "textDx": -7, "textDy": 0+1, "textFontSize": 10
} , { "lat": 52.6180, "lon": -1.11189, "size": "140", "color": "blue", "strokeColor": "blue", "shape": "circle", "text": "", "textAlign": "right", "textBaseline": "middle", "textDx": -11, "textDy": 0+1, "textFontSize": 10
"shape": "circle", "size": "0", "text": "1", "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": 5, "textFontSize": 10, "textFontWeight": "bold", "textColor": "white" } , { "lat": 52.61819, "lon": -1.11035, "size": "140", "color": "blue", "strokeColor": "blue", "shape": "circle", "text": "", "textAlign": "right", "textBaseline": "middle", "textDx": -11, "textDy": 0+1, "textFontSize": 10
"shape": "circle", "size": "0", "text": "2", "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": 5, "textFontSize": 10, "textFontWeight": "bold", "textColor": "white" } , { "lat": 52.62324, "lon": -1.11179, "size": "140", "color": "blue", "strokeColor": "blue", "shape": "circle", "text": "", "textAlign": "right", "textBaseline": "middle", "textDx": -11, "textDy": 0+1, "textFontSize": 10
"shape": "circle", "size": "0", "text": "3", "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": 5, "textFontSize": 10, "textFontWeight": "bold", "textColor": "white" } , { "lat": 52.62123, "lon": -1.111297, "size": "140", "color": "blue", "strokeColor": "blue", "shape": "circle", "text": "", "textAlign": "right", "textBaseline": "middle", "textDx": -11, "textDy": 0+1, "textFontSize": 10
"shape": "circle", "size": "0", "text": "4", "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": 5, "textFontSize": 10, "textFontWeight": "bold", "textColor": "white" } , { "lat": 52.62009, "lon": -1.11241, "size": "140", "color": "blue", "strokeColor": "blue", "shape": "circle", "text": "", "textAlign": "right", "textBaseline": "middle", "textDx": -11, "textDy": 0+1, "textFontSize": 10
"shape": "circle", "size": "0", "text": "5", "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": 5, "textFontSize": 10, "textFontWeight": "bold", "textColor": "white" } , { "lat": 52.61936, "lon": -1.11510, "size": "140", "color": "blue", "strokeColor": "blue", "shape": "circle", "text": "", "textAlign": "right", "textBaseline": "middle", "textDx": -11, "textDy": 0+1, "textFontSize": 10
"shape": "circle", "size": "0", "text": "6", "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": 5, "textFontSize": 10, "textFontWeight": "bold", "textColor": "white" }
], "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" } ] }, "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> |
Listed buildings in Stoneygate 1 2 3 4 5 6 |
If numbered dots are needed, instead of (or as well as) text labels, this can be achieved using the built in shapes. For example shape1=n-circle
will place a numbered dot at that coord position (or l-circle for letters). Generally it is much better to use the dots in sequence, so each numbered mark gives a numbered dot, and they will match the full screen ones. If auto-caption=1
then the caption will generate a numbered list using the mark-title
entries. For example:-
{{OSM Location map | coord={{إحداثيات|52.620|-1.112}} | float=left| zoom =15 | width = 200 | height = 300 | mark-coord1 = {{إحداثيات|52.6180|-1.11189}} | mark-title1 = St John The Baptist Church | shape1=n-circle | shape-color1=blue | shape-outline1=white | mark-size1=16 | mark-coord2 = {{إحداثيات|52.61819|-1.11035}} | mark-title2 = Congregational Church | mark-coord3 = {{إحداثيات|52.62324|-1.11179}} | mark-title3 = Eastfield, Stanley Road | mark-coord4 = {{إحداثيات|52.62123|-1.111297}} | mark-title4 = Stoneygate School | mark-coord5 = {{إحداثيات|52.62009|-1.11241}} | mark-title5 = The Firs | mark-coord6 = {{إحداثيات|52.61936|-1.11510}} | mark-title6 = White House | caption = Listed buildings in Stoneygate | auto-caption=1 }}
The other built-in shapes can be used in the same way (n-square, n-diamond etc). The shape-outline1=
value sets the colour for the number (unlike normal, when it sets the shape-outline), and as with the others, only the mark1 values need to be set for many values, to establish the default for this map, which can be overridden as required. The numbered1..2..3 etc
parameters can override the automatic numbers or letters to use your own values for each mark.
Full list of parameters
London's Heathrow Airport |
<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,"lang": "ar", "width":300, "height": 300, "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": "51.46534"} }, {"name":"imgLon", "init": {"expr": "-0.44542"} }, {"name":"imgZoom", "init": {"expr": "12"} }, {"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": "1"} }, ], "data": [ { "name": "data", // Otherwise use the first unnamed argument for source values "values": [ { "lat": 51.46534, "lon": -0.44542, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/1/10/Mapscaleline.svg/120px-Mapscaleline.svg.png", "width": 50, "height": 8, "offsetX": -66, "offsetY": 140, "textAlign": "right", "textDx": 22, "textDy": -2, "textColor": "grey", "textFont": "Tahoma", "textFontSize": 9, "text": "2km" } , { "lat": 51.471867, "lon": -0.456726, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Airplane_silhouette.svg/20px-Airplane_silhouette.svg.png", "height": 20, "width": 20, "text": "Terminals 1 & 3", "textAlign": "center", "textBaseline": "bottom", "textDx": 0, "textDy": -12, "textFontSize": 13, "textColor": "Blue"
} , { "lat": 51.470156, "lon": -0.448497, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Airplane_silhouette.svg/20px-Airplane_silhouette.svg.png", "height": 20, "width": 20, "text": "Terminal 2", "textAlign": "center", "textBaseline": "top", "textDx": 0, "textDy": 12, "textFontSize": 13, "textColor": "Blue"
} , { "lat": 51.471948, "lon": -0.487883, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Airplane_silhouette.svg/20px-Airplane_silhouette.svg.png", "height": 20, "width": 20, "text": "Terminal 5", "textAlign": "center", "textBaseline": "top", "textDx": 0, "textDy": 12, "textFontSize": 13, "textColor": "Blue"
} , { "lat": 51.459409, "lon": -0.446459, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Airplane_silhouette.svg/20px-Airplane_silhouette.svg.png", "height": 20, "width": 20, "text": "Terminal 4", "textAlign": "right", "textBaseline": "middle", "textDx": -12, "textDy": 0+1, "textFontSize": 13, "textColor": "Blue"
} , { "lat": 51.467269, "lon": -0.4233598, "img": "wikirawupload:https://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Underground.svg/14px-Underground.svg.png", "height": 14, "width": 14, "text": "Hatton Cross", "textAlign": "left", "textBaseline": "middle", "textDx": 9, "textDy": -6+1, "textFontSize": 13, "textColor": "Blue"
}
], "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" } ] }, "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> |
With five terminals, مطار لندن هيثرو, is the busiest airport in Europe. |
Blank template | Example | |
---|---|---|
{{OSM Location map | coord = {{إحداثيات| | }} | zoom= | float = | width = | height = | fullscreen-option = | caption = | title = | minimap = | mini-file = | mini-width = | mini-height = | minipog-x = | minipog-y = | scalemark = | shape = | shape-color = | shape-outline = | mark = | mark-size = | mark-dim = | mark-coord = {{إحداثيات| | }} | label = | labela = | labelb = | label-size = | label-color = | label-angle = | label-pos = | label-offset-x = | label-offset-y = | mark-title = | mark-image = | mark-description= <!-- second and subsequent markers--> | mark-coord1={{إحداثيات| | }} | label1= }} |
{{OSM Location map | coord={{إحداثيات|51.46534|-0.44542}} | zoom=12 | float = right | width = 360 | height = 300 | fullscreen-option= | caption = [[File:Heathrow Airport 014.jpg|360px]]<br>With five terminals, [[مطار لندن هيثرو]], is the busiest airport in Europe. | title=London's Heathrow Airport <!--------> | minimap = yes | mini-file = | mini-width = | mini-height = | minipog-x = | minipog-y = | scalemark = 180 <!--------> | shape = image <!-- start of first label. More marks and labels are added with mark1, label1 etc. The first numbered set acts as a 'master marker', and its parameter values are inherited as defaults by any other numbered markers.--> | shape-color= | shape-outline= | mark = Airplane silhouette.svg | mark-size = 20 | mark-coord = {{إحداثيات|51.471948|-0.487883}} | label = Heathrow Terminal 5 | labela = | labelb = | label-size = 13 | label-color = MidnightBlue <!-- but see bug report in below --> | label-angle = | label-pos = top |label-offset-x = 19 |label-offset-y = | mark-title = Heathrow Airport Terminal 1 | mark-image = Heathrow Terminal 1 - geograph.org.uk - 581459.jpg | mark-description=Terminal 1 at [[مطار لندن هيثرو]], the busiest airport in Europe. <!--------> <!-- Subsequent markers add a number 1 to 9 to the marker parameters, mark-coords are required for each marker. Most other values are inherited from the first of the numbered markers, mark1= etc, which acts as the 'master marker'--> }} |
المعلمات
Map display parameters | |
---|---|
Parameter | Description |
coord
|
Latitude and longitude coordinates of the centre point of the map. Use coord={{إحداثيات| latitude | longitude}}. {{إحداثيات}} can deal with a wide range of formats. eg: coord={{إحداثيات|57|18|22|N|4|27|32|W}}, coord={{إحداثيات|44.112|N|87.913|W}}, coord={{إحداثيات|44.112|-87.913}}. This may not be the 'coord' points of the page, as an appropriate framing area for the map may place the subject off-centre. (Marker point(s) are set separately, see below). gridreferencefinder.com, is a helpful place to find coordinates, or you can right=click on the 'Full screen linked' map.
|
zoom
|
Sets the scale of the map, from 0 to 19, to the levels defined by the Open Street Map foundation. (details here). The actual distances represented will vary depending on the latitude, as the scale defines different fractions of a degree. The apparent scale will also vary hugely depending on the monitor being used, the browser magnification level, etc. For most Wikipedia situations, maps with a zoom of 10 (notionally 1:500,000) up to 16 (1:8,000) are likely to be of most use. |
float
|
Positions the frame to the left, centre (or center) or right. (default is right). If centred, the text will be forced above and below, otherwise text will wrap to the side. |
width height
|
Sets the width and height of the map in pixels. Only the number is required (ie no px). Default is 350 by 250 pixels. |
fullscreen-option
|
By default a [Full screen] link is supplied in the bottom left of the frame. By setting this to 0 or no, the link will not appear, should that be preferred. |
caption auto-caption
|
Optionally, a text caption can be included, below the map. Unless overridden by tags etc, this is left-justified plain text. It can include any wiki-item that can be inserted into a table cell, including images, formatting, citation references, etc. If auto-caption=1 , a numbered list will be automatically generated to follow any caption. This will generally only make sense when using numbered dots.
|
title
|
Optionally a title or other text can be placed in a cell above the map. By default this is centred and bold, but as with the caption, any wiki-markup etc can be included. |
map-data
|
Allows an OSM ExternalData element to be added to the map. This can be an administrative area, highway or other map element that has been assigned a wikidata Q value. (eg: map-data=Q83065 will add the city boundary of Leicester.) The map item needs to be on the same place as the map itself. It currently only allows line features (not areas etc), which appear as thick orange lines. Multiple elements can be added, separating each Q value by a comma. A major limitation as of 12 Dec 2016 is that it only appears on the 'fullscreen' map, not on the framed map on the page. Adding map-data items now should mean they appear on the page if and when this limitation is overcome. nominatim.openstreetmap.org/ has a search engine to identify data elements for which Q values have been assigned, or to add wikidata Q values to map elements.
|
minimap
|
Used to add an optional locator minimap in the bottom left corner. If set to on it adds a 'built in' small(ish) world map with a locator dot showing the position of the main map. (This is a feature supplied by the underlying 'Graph:' template, so the only control over it is to be set as on or off.) If set too off it is not used. If set to file it requires the next section details to be added, which will include a custom map. Default is no.
|
mini-file
|
Takes the file name of a standard location map from commons, and displays it as a minimap in the bottom left corner, provided minimap=file . This can be used to show a larger entity from which the main map is drawn.
|
minipog-x
|
Within the custom minimap this can place an optional small Red pog. Nb. The x and y are not lat and lon values. They relate to the mini-width and mini-height. The origin is top,left of the mini map, so if mini-width=80 and minipog-x=20, it will be a quarter of the way across. (Some location maps have a highlighted location already, so leaving these two parameters undefined gives the map without a dot.) |
scalemark
|
By default or with scalemark=1, a scale line with guide to the scale of the map is supplied in the bottom right corner of the map. If this is not required - eg if it interfers with a map element at that point - it can be turned off by setting this to '0'. To shift it further left, eg to avoid a minimap, or to avoid a 'busy' bit of the map, enter the number of pixels. eg scalemark=180 will move it to the left of the built-in minimap. If there is no minimap it does not need to be mentioned. |
Label and mark parameters.
Thirteen marks can be set on the map, being an un-numbered version, and the rest numbered 1 to 12. The first numbered one, (mark1, label1, etc.) is a 'master marker' and its values (or defaults) are inherited by the other numbered markers unless set individually. All label, mark and full-screen parameters are available for each numbered marker. This allows the un-numbered mark to be used as the subject of the map, with specific mark and label values of its own. (It will also be point 1 on the Full Screen map unless | |
Parameter | Description |
shape
|
OSM Location map can use either an external image as a location marker, or one of various built-in shapes. Shape should either be set as =image or can be a circle, square, cross, diamond, triangle-up or triangle-down. If blank or absent it will default to 'image', and use either a Red pog.svg or specified mark = image. If numbered dots are required, use shape1=n-circle Subsequent markers will use the same setting, and automatically number up to 15. shape1=l-circle will do the same but with letters, and any of the built in shapes can be used.
|
shape-color shape-outline numbered
|
Set the shape infill and outline to any color, using HTML colour names, X11 color names, hex triplets (eg #FF0000) etc, as described at ألوان الويب. Only used for built in shapes. Setting them to the same value gives an appearance of no outline.Default = #B80000 (a dark red) (but see bug report below). The numbered parameter is used with numbered shapes, to override the automatically allocated number.
|
mark
|
The name of a wikimedia commons file, which is used as the marker. Default is Red pog.svg. Other pog colours are available, and a large range of map markers can be found at Commons:Location markers and Commons:Category:Map icons |
mark-size mark-dim
|
Size and dimensions of a marker. mark-size is used by both shape and mark to define the size of the marker symbol. It sets the height of the mark or shape in pixels (no 'px' required, default is 10). If only a text label is wanted with no marker, set mark-size=0 . mark-dim is used to give a non-square mark. (It has no effect with the built in shapes.) default is 1, ie equal width and height. A value of 1.4 will give a typical landscape rectangle. 0.7 will give a typical portrait rectangle. If the original mark-file is non square, a value here is needed to correct the proportions.
|
mark-coord
|
Latitude and longitude coordinates of the marker point. Use the format mark-coord={{إحداثيات|lat value|lon value}} . Used by either shape and mark as well as the related label . If the location is outside the area of the map, it will not appear. (for backwards compatibility mark-lat and mark-lon still work, but are not the preferred method.)
|
label labela labelb
|
Text to appear alongside a mark or shape. No inline formatting, line wrapping, or other tags, links etc are possible. If left blank then any mark will show without a label. If only a text label is wanted with no marker, set mark-size=0 A blank label and a mark-size=0 will result in an invisible marker, which will still feature on the Full screen option. If the label is too long for a single line, use labela and labelb for 2nd and 3rd lines. nb if labelb is set without a labela, there will still be a gap where labela would go.
|
label-size
|
Sets the text size for the label, in points. default = 10 |
label-color
|
Sets the text colour for the label. The standard colour labels (red, black, grey, white, blue, green etc...)all work well. Default=dark red. In theory any HTML colour name, X11 color name, hex triplet (eg #FF0000) etc, as described at ألوان الويب should work, but some currently have a problem.
[Bug report: Works unexpectedly with some built-in shape combinations and when using |
label-pos
|
Sets the position of the label, relative to the marker: left, right, top or bottom. Default=left. Top and bottom text is center-justified, whereas left and right align against the marker. The label aims to be an appropriate distance from the edge of the marker, but irregular shapes and larger sizes may need further adjustment using the label-offsets. |
label-angle
|
It is possible to specify a label-angle = , which will pivot the label text around the centre of the marker point by the specified number of degrees. (+ve angle rotates clockwise, -ve anticlockwise) If mark-size is set to zero, this has the effect of a free-floating label with no marker, useful for various geographic and linear features.
|
label-offset-x label-offset-y
|
Allows adjustment of the label location in an x and y direction, relative to its mark coordinates, by the specified number of pixels. It can be +ve or -ve numbers. Higher -x values will move the label to the right. Higher -y values move it down the map. Default is 0,0. |
Additional content for Full screen link
The 'full screen' map has a richer map environment, including the option for users to scale in and out, to pan across the map, and to find (via the 'More details' button) other maps and satellite imagery for the location. It also includes numbered markers, for which tooltip-style titles, and image thumbnails with captions can be brought up. This makes most sense where there are several markers on the map. The content for this facility is set with the following three parameters - which need the 1..12 numbers adding for each marker: | |
Parameter | Description |
mark-title
|
This title appears as a tooltip and also a thumbnail title, accessed via the marker. if mark-title=none that will exclude that marker from the full screen map. (it will still show as normal on the main map).
|
mark-image
|
This provides a pop-up thumbnail image when the marker is clicked. Include only the image name from wikimedia commons etc. (ie no brackets, or 'File:'). |
mark-description
|
Caption text, which will either accompany a pop-up photo, or if no photo then as a text box, when the marker is clicked. This can include wikilinks etc, to link on to additional relevant articles. |
Underlying technology
OSM Location map itself has no map or display ability of its own. Everything within the frame is produced through the template {{Graph:Street map with marks}}, created by مستخدم:Yurik. This in turn calls internal processes that turn all the data supplied at edit time into a rendered bitmap image, so that there is no calculation overhead by the time the page is read by a user, any more than any other commons image.
Whilst the map is being edited and previewed, the page is supplied with a rasterised image, collating the base-map, marks, labels, etc on the fly. It will be particularly noticable on small fonts that when the 'Save Changes' button is pressed, the resulting bitmap has much worse fonts than the preview. (Maybe this will be improved at some point). The process of updating the map image and providing the right bitmap is all handled internally and invisibly. One of the consequences of the 'bitmap' solution, which is different from the standard {{خريطة مواقع}} method, is that there is no text or objects on the final image, so there is no possibility of adding wikilinks within the template.
The full screen option, which can be clicked through from below the map, provides an entirely different mapping approach, using the same base-map data. This provides an interactive map that can be panned and zoomed. It also replicates (although at present only as numbered markers) the various marks from the page map. These can then be given more content, by way of a title, caption and image. The caption and title can then be given all the wikilinks and other markup features that may be desired, providing a map-based page that will offer another way of engaging with the article content.
Future development of the various mapping technologies is likely to result in further options for showing maps on wikipedia. In particular, something more like the fullscreen interactive map, but within a frame, is likely to emerge. It has a much higher processor overhead than the bitmap based solution, which seems to be one reason for a slow and cautious development. The most likely main use of that might be within info-boxes, where the whole map is automatically generated from already available data.
This, on the other hand, is better suited to a hand-edited map, in which the area displayed and the selection of items and labels included are selected, edited, and added to, to suit the specifics of the subject in hand. A further approach, which is not currently supported within this template, but is available via the inderlying 'Graph' template, is to draw the data from ويكي بيانات, using a query that provides the selection of marks requested.
The 'Graph' technology used here is described as under development, so while it is highly likely that this or a similar solution will still be available, it may evolve over time.