Widget:Zone map track

From Guild Wars 2 Wiki
Jump to navigationJump to search

This widget uses Leaflet.js and a wiki-hosted version of the official maps/continents API endpoints to display interactive maps on the wiki. This widget can either display an entire continent or one zone, or more than one zone. It utilises map tiles stored on the wiki within Category:Map raster tiles, and as such cannot display maps that aren't on the default ground floor (i.e. cannot be used for dungeons or fractals).

Although there is lots of placeholder code within this widget (originally intended to be amended with an API update), it seems unlikely at this point (several years later) that the render service will ever be updated and therefore the code within this widget is provided as-is with no intention to update it.

Parameters

All parameters are optional.

map
Optional. A comma separated list of map ids to display. If not specified, all maps will be displayed.
continent
Optional. Defaults to 1, which will show Tyria. If set to 2, displays The Mists.
floor
Optional. Defaults to 1, which is currently the only valid choice.
markers
Optional. An array of javascript object key-value pairs describing the markers. See the example code below, but supported key-value pairs include:
  • coord (Required. Either a pair of coordinates, or an array of coordinate pairs)
  • name (Required. Hover title and popup name)
  • link (Optional. Wiki link)
  • text (Optional. Free text description)
  • id (Optional. Numerical ID. If the marker type is set to "label", this will be what is shown on the map)
  • icon (Optional. Name of a wiki file to use as an icon instead of the default Personal waypoint blue star. Don't include the "File:" prefix, but do include the ".png" suffix)
  • type (Optional, but defaults to marker. Valid options include: rect (using the coordinates as opposite corners), poly (a polygon where all points are joined), antpoly (same but with moving ants), line (join each of the points), antline (same but with moving ants), label (text), and marker (single markers))
  • color (Optional. Defaults to green, "rgba(0,205,0,0.8)")
  • weight (Optional. Defaults to 5)
  • dataId (Optional. For marker icons, this is the value of the data-id attribute)
fit
Optional. The type of zoom fitting to be performed upon initial load; defaults to "zone". May be specified as "markers" to zoom upon load to fit (with a bit of padding) around all the custom markers, or "sectors" to fit around the sectors.
size
Optional. There are two options, which reflect names of CSS classes; "normal-map" (default) and "huge-map".
layers
Optional. Comma separated list of layers to show upon map initialization. Options: continent_rect, zone_rect, zone_names, sectors, sector_names, waypoint, tasks, landmark (note this is the API internal name for what the wiki calls points of interest), points_of_interest (note this is the API internal name for what the wiki calls landmarks/dungeons/fractals/strikes etc), skill_challenges, vista, adventures, mastery_points, jumping_puzzles, misc, custom
debug
Optional. If set to y, prints certain variables to the browser's developer console.
cache
Optional. If set to n, disables caching of the output.js query.
{{#Widget:Zone map track | map = 20 | markers =
 { "name": "Marker One Name", "coord": [62955, 30471], "text": "This is a simple sentence describing the marker."  },
 { "name": "Marker Two Name", "coord": [63272, 30873], "text": "This is a sentence containing a working [[Main Page|wiki link]]." },
 { "name": "Marker Three Name", "coord": [62749, 30892], "text": "I ran out of example ideas, but remember to enclose sentences in doublequotes." },
}}

Notes

See also