Widget:Test map

From Guild Wars 2 Wiki
Jump to navigationJump to search

This extremely lightweight widget uses Leaflet.js and nothing from the official API; it relies on manually specified data to display markers. It does however use tiles from the render service where available.

This widget should only be used once per page.

Usage

{{#Widget:Test map}}

Parameters

width
height
The widths and heights to use for the map frame. Do not specify the "px" suffix.
notiles
Optional. If set equal to "y", no tiles will be displayed.
continent
The continent for the tiles to be rendered for. Typically 1 for core tyria. I.e. the blue bit https://tiles.guildwars2.com/2/3/3/6/3.jpg
floor
The floor for the tiles to be rendered for. Typically 0-3 for most of tyria. I.e. the purple bit https://tiles.guildwars2.com/2/3/3/6/3.jpg
zoom
The initial zoom. Typically 6. I.e. the green bit https://tiles.guildwars2.com/2/3/3/6/3.jpg
center
An array of coordinates to center the map around upon initial page load.
markers
The data to display, specified as a JSON formatted object.
The first level keys are used as map layers.
The first level values are an array of marker objects.
The second level marker objects can use the following fields: coords, name, icon.

Example wikicode

{{#Widget:Test map
 | width = 800
 | height = 800
 | continent = 2
 | region = 7
 | floor = 3
 | zoom = 3
 | center = [10735, 10729]
 | markers = {
    "Zones":
        [
            { "name": "Continent 2 continent_dims", "coords": [[0,0],        [16384,16384]], "notes": "https://api.guildwars2.com/v2/continents/2" },
            { "name": "Floor 3 clamped_view",       "coords": [[5118,6922],  [16382,16382]], "notes": "https://api.guildwars2.com/v2/continents/2/floors/3" },
            { "name": "Region 7 continent_rect",    "coords": [[17664,8192], [23808,21376]], "notes": "https://api.guildwars2.com/v2/continents/2/floors/3/regions/7" },
            { "name": "Map 1099 continent_rect",    "coords": [[9214,8958],  [12286,12030]], "notes": "https://api.guildwars2.com/v2/continents/2/floors/3/regions/7/maps/1099" }
        ],
    "Sectors":
        [],
    "Waypoints":
        [
            { "id": 2301, "coords": [10775,10071], "name": "Stoic Rampart Waypoint" }
        ],
    "Points of Interest":
        [
            { "id": 2307, "coords": [10735,10729], "name": "Central Oasis" }
        ]
}
}}