• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Beta Wikipedia

Template:Map with marks

  • Template
  • Discussion
  • Language
  • Watch
  • Edit
Template documentation[view] [edit] [history] [purge]

Lua error in Module:TNT at line 167: Missing Commons dataset I18n/Module:TNT.tab. Shows an image of a map, and draws user-specified images/icons on top of it using latitude/longitude coordinates.

Markup Result
Simple map with a single marker, custom size, and no minimap
{{Map with marks | width=400 | height=150 | lat=37.8 | lon=-122.4 | zoom=5 | minimap=false |

  { "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
{{Map with marks | lat=40.816667 | lon=14.433333 | zoom=6 |

{"lat": 40.816667, "lon": 14.433333, "shape": "diamond", "size": 70, "offsetY": -10, "text": "Mount Vesuvius", "textFontWeight": "bold", "textFontSize": 16, "textColor": "#2A4B8D"},

{"lat": 40.948333, "lon": 15.635556, "img": "Volcano red 32x32.svg", "width": 16, "height": 16,  "offsetY": -20, "text": "Mount Vulture", "textFontWeight": "bold", "textFontSize": 16, "textColor": "#2A4B8D"}

}}
One marker with labels on a blank map
{{Map with marks | style=osm | lat=40.816667 | lon=14.433333 | zoom=6 |

{"lat": 40.816667, "lon": 14.433333, "shape": "diamond", "size": 70, "offsetY": -10, "text": "Mount Vesuvius", "textFontWeight": "bold", "textFontSize": 16, "textColor": "#2A4B8D"},

}}
Data from Commons Dataset
Same as above, but this time the data is stored on Commons in a table Data:Sandbox/Yurik/Street map with marks sample.tab
{{Map with marks | lat=40.948333 | lon=15.635556 | zoom=6 | table=Sandbox/Yurik/Street map with marks sample.tab}}
(Lua error in Module:TNT at line 167: Missing Commons dataset I18n/Module:TNT.tab.)
Show all Armenian heritage sites, by querying it from Wikidata
The query result should have the same columns (fields) as in the other examples (text, img, ...), except coordinates should be returned as coord column
{{Map with marks | lat=40.347 | lon=47.260 | zoom=6 | colorScaleField=type | wdqs=
# Each location should show only once. This query may output all the same values as in the other examples, such as "text", "img", and others.
SELECT (SAMPLE(?coord) as ?coord) (SAMPLE(?type) as ?type)
WHERE {
  ?item wdt:P3170 ?heritageId .
  ?item wdt:P625 ?coord .
  ?item wdt:P31 ?type .
}
GROUP BY ?item
}}
(Lua error in Module:TNT at line 167: Missing Commons dataset I18n/Module:TNT.tab.)
{{Map with marks | lat=-33.8688 | lon=151.2093 | zoom=10 |
{
  "lat": -33.8688,
  "lon": 151.2093,
  "img": "Opera_House_and_ferry._Sydney.jpg",
  "width": 48,
  "height": 36,
  "text": "Sydney",
  "textFontWeight": "bold",
  "textFontSize": 20,
  "textColor": "#00f",
  "textAlign": "right",
  "textDx": -30
}
}}

The data template parameter must be a comma separated list of "JSON" objects. Each object starts with a "{", has a list of comma separated key-value pairs, and ends with a "}". The key may be one of the following values (used no more than once per each object):

Built-in marker shapes
shape "circle" (default), "square", "cross", "diamond", "triangle-up", "triangle-down" (docs)
color shape fill color, e.g. "#ff0000" (red - default)
strokeColor shape outline color
size shape size (number)
Text labels (see more info)
text Label text
textAlign Label's horizontal alignment relative to the marker - "left", "right", "center". By default, left for LTR, right for RTL languages.
textBaseline Vertical alignment: "middle" (default), "top", "bottom"
textColor Label text color, e.g. "#ff0000" (red)
textDx, textDy Horizontal and vertical distance from the marker
angle Draw text at an angle
radius/theta Radial positioning of the label relative to the marker
font, fontSize, fontWeight, fontStyle Font name, size, boldness, and style
Image markers
img URL of an image, e.g. wikirawupload:{{filepath:Volcano red 32x32.svg|32}}
height, width Size of the image
offsetX, offsetY Shift the center of the image on the map

See also

edit
  • Template:Location map
  • Template:OSM Location map - to use this mapping template with standard wikipedia syntax
  • Template:Query map - automtically produce a map showing all of a certain type of thing in a certain area, e.g. lighthouses in Cornwall.

Template data

edit

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

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
data1

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

Stringsuggested
widthwidth

Total width of the graph

Numberoptional
heightheight

Total height of the graph

Default
Half of the width
Numberoptional
paddingpadding

no description

Numberoptional
latlat

Latitude of the map's center

Numberoptional
lonlon

Longitude of the map's center

Numberoptional
zoomzoom

Map zoom level (0..18)

Numberoptional
langlang

The language code of the language to use to draw the labels on the map. Use special value 'local' to draw the labels in the language of the area being depicted. Uses the page language by default.

Stringoptional
wdqswdqs

An optional Wikidata query to use instead of the data - the query would generate a list of items just like data, but it must contain a "coord" field with the location

Stringoptional
colorScaleFieldcolorScaleField

If given, this data field will be used to make dots of different color, one color per unique value of this field

Stringoptional
minimapminimap

If set, 0 or false will always hide the map, and 1 or true will always show it. Make sure the map is big enough include the minimap. By default, the map will be shown for zoom levels 5+ if the map is sufficiently large

Booleanoptional
  • v
  • t
  • e
Graph, chart and plot templates
Many types
Template:Graph:Chart, Module:Chart
Graph Extension
Template:Graph:Chart, Template:Graph:Lines, Template:Graph:Stacked, Template:Graph:Street map with marks
Bar
Template:Bar chart, Template:Bar box
Line
Template:Graph:Lines
Scatter plot
Template:Dot chart
Pie chart
Template:Pie chart
Tree
  • Template:Tree chart
  • Template:Ahnentafel
Stacked
Template:Stacked bar
Cartogram
Template:Graph:Map, Template:Global Heat Maps by Year
Color legends
Template:Legend, Template:Legend-line, Template:BrewerColorLegends
The above documentation is transcluded from Template:Map with marks/doc. (edit | history)
Editors can experiment in this template's sandbox (edit | diff) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.beta.wmcloud.org/w/index.php?title=Template:Map_with_marks&oldid=582479"
Last edited on 26 April 2023, at 23:26

Languages

      This page is not available in other languages.

      Beta Wikipedia
      • Wikimedia Foundation
      • Powered by MediaWiki
      • This page was last edited 23:26, 26 April 2023 by Beta Wikipedia user Jdlrobson.
      • Content is available under CC BY-SA 4.0 unless otherwise noted.
      • Privacy policy
      • About Wikipedia
      • Disclaimers
      • Contact Wikipedia
      • Code of Conduct
      • Developers
      • Statistics
      • Cookie statement
      • Terms of use
      • Desktop