Jump to content

Template:Graph:Map with marks/doc

From mediawiki.org
Markup Result
Simple map with a single marker

{{ Graph:Map with marks |
{"lat":37.8, "lon":-122.4}
}}

Two markers with labels - one as diamond shape, one uses an image from Commons
Text label can be customized with all of Vega text mark parameters by prepending "text" to their name

{{ Graph:Map with marks |
{"lat":37.8, "lon":-122.4, "shape":"diamond", "color":"#0f0", "size": 100, "text": "Diamond"},
{"lat":-10, "lon":20, "img":"wikirawupload:{{filepath:Volcano red 32x32.svg|32}}", "width":25, "height": 25, "offsetY":-10, "text": "Volcano", "textFontWeight": "bold", "textFontSize": 20, "textColor": "#fff"},
}}

Set a different background image
Also uses equirectangular projection

{{ Graph:Map with marks | background=WorldMap-A non-Frame.png |
{"lat":37.8, "lon":-122.4, "size": 100, "text": "San Francisco", "textFontWeight": "bold"}
}}

Use a region of the world with a bounding box, and a right-aligned label
Bounding box uses [left, bottom, right, top]
Longitude: max left..right range is -180..180
Latitude: max bottom..top range is -90..90

{{ Graph:Map with marks | width=200 | height=200 | bbox=[90,-90,180,0] | background=WorldMap_-270,-90,-180,0.png |
{"lat":-33.8688, "lon":151.2093, "img":"wikirawupload:{{filepath:Opera_House_and_ferry._Sydney.jpg|48}}", "width":48, "height": 36, "text": "Sydney", "textFontWeight": "bold", "textFontSize": 20, "textColor": "#00f", "textAlign": "right", "textDx": -30},
}}

Shows an image of a map, and draws user-specified images/icons on top of it using latitude/longitude coordinates.

Template parameters

ParameterDescriptionTypeStatus
data1

Comma separated list of JSON objects that describing what data to draw on the map

Stringsuggested
backgroundbackground

Background map image filename

Fileoptional
widthwidth

Total width of the graph

Numberoptional
heightheight

Total height of the graph (Mercator projection is 2:1)

Default
Half of the width
Numberoptional
paddingpadding

no description

Numberoptional
projectionprojection

Name of the D3 geo projection to use

Stringoptional