Help:Interactive Maps

From LUMbA Wiki
Jump to navigation Jump to search

Template:Enabled by default Interactive Maps is a feature available on Fandom that enables communities to design their own customized maps. It is available to any community that wants to use it.

Getting Started

Map creation and editing is open to all users. You can find the "Interactive Maps" link in the Explore menu of the top navigation, or you can directly navigate to the creation tool by visiting Special:AllMaps on your wiki, where you can create your own Map and find a list of every Map that exists on your community.

All Interactive Maps live in the Map: content namespace, e.g., /wiki/Map:My_New_Map. Maps created in any other namespace, including as a userspace subpage, will not be correctly generated. When creating a Map via the button on Special:AllMaps, this namespace is automatically added, omitting the need to make this part of the page title.

Unless you have set your preferences to use the source editor, the "Edit" button at the top right of any page in the Map namespace will open the visual Interactive Maps Editor, which is a user-friendly option to edit Maps quickly and easily. Clicking "Edit source" from the dropdown menu will instead take you to the source editor and load the base JSON (JavaScript Object Notation) structure for the Map. If you have the source editor selected as your preference, these options are reversed, and the button in the dropdown reads "Edit map". Clicking the pencil icon present on the map itself will always open the visual Interactive Maps Editor, regardless of your preferred editor. While inside the visual Interactive Maps Editor, hovering over the button with the three vertical dots will open a dropdown with the option to "edit source".

Building a Map using Interactive Maps Editor

File:Map Theme Designer.png
Interactive Maps Editor

Map Display

This section allows you to view your Map name, upload a Map image as your background, and group markers that are in close proximity.

  • Map Name: This is the title of your Map. Your Map will be viewable using the URL /wiki/Map:My_New_Map, where My New Map is the name that you chose. If you wish to change the name after the Map's creation, hover over the button with the three vertical dots in the top right-hand corner on the Map itself and select the option "move". This will close the Interactive Maps Editor and take you to Special:MovePage.
  • Map Description (optional): This will add a text description above your Map in the Map namespace to tell viewers as well as Google what this Map is about and how it fits into the context of your wiki. It will also feed future map search results. This field supports wikitext, and the character limit is 200.
  • Map Image: Click on this area to upload or select the image you would like to use for your Map. The permitted file types are .jpg, .jpeg, .png, and .svg. The maximum file size is 10 MB. Once uploaded, there is an option to replace the image, but doing so may require you to reposition markers placed on the Map. Note that saving a Map without a background image will result in the loading of a blank page.
  • Group Markers: Toggle this option "on" to simplify the number of markers on a Map by grouping ones that are in close proximity. If you click on a grouped location, it will zoom in and show a sub-group or individual markers in a selected location. We recommend grouping large numbers of markers for a better viewing experience.

Categories

Organize markers of a similar kind by grouping them into categories. This list will appear next to the Map and allows you to filter markers by categories.

  • Creating categories: Click the "+ Add Category" button to create a new category.
  • Renaming categories: Click on the category name to change it.
  • Re-ordering categories: Grab hold of the horizontal bars on the right of the category and drag to re-order the categories in the list.
  • Deleting categories: Clicking on the category name will transform the horizontal bar into a trashcan icon to give you the option to delete the category.
  • Customizing category markers: Click the pin icon on the left of the category to open a menu that allows you to customize how markers are displayed for that category.
    • Background color: This will change the color of the marker icon. Click on the colored square to select a color using the color slider or input a hex code in the field to the right.
    • Emoji or Character: You may choose to add an emoji or single character as a customization option within category markers. This field has a 1-character limit. After adding an emoji or character, it will be displayed inside the default marker icon in place of the dot in the center. To delete the emoji or character, click the X on the right of the input field.
    • Custom icon: Click on this area to upload an image file as a custom icon image for the category, which will replace the default pin icon. The permitted file types are .jpg, .jpeg, .png, and .svg. The file size for the icon should be between 32x32px and 64x64px. Once uploaded, there is an option to replace or delete each custom icon individually. Know that all markers pins are lined up at the bottom center, regardless of their shape. So if you use a round marker rather than a pin, you'll have to align it yourself at the bottom center and not the middle of the circle.
    • While the options to either upload a custom icon or use an emoji/character are always enabled, both cannot be active at the same time. In order for the emoji or character to be displayed, you cannot have a custom icon image in use. Uploading an icon image after choosing an emoji will override the emoji and replace it with an image.

Markers

To add a marker to your Map, click the pin icon in the top right-hand corner. Move your cursor to the desired placement on the Map and click to drop it. After you place the marker, a menu will come up with several options that control how your marker will appear on the Map:

File:Edit Marker.png
Marker Editor with all its functions
  • Title: This is the name of your marker/location. It must be 50 characters or less.
  • Description (optional): This description will be displayed under your title in the pop-up window when your marker is clicked on. This field supports wikitext, so all wikitext specific characters will be displayed in standard wikitext format. The description is limited to 300 characters or less, including wikitext characters that will not be shown in the final marker tooltip. You must save your changes to the marker tooltip in order to see your wikitext rendered.
  • Image (optional) Click on this area to upload or select an image to use in this marker's popup. The permitted file types are .jpg, .jpeg, .png, and .svg. The maximum file size is 10 MB. Once added, there is an option to replace the image, or remove it from the marker. The image will be placed under the title and description and above the link. The image is automatically sized to fit inside the pop-up container, at a width of 264px.
  • Link (optional): You have the option to link to any article on your wiki (perhaps one that gives more detail on the selected marker/location).
    • Page title: Put the name of the article you would like to link in this field. It does not matter whether you use spaces or underscores for article names. Do not put the entire url here, just the page title.
    • Link display text: Choose how you would like the link text to be displayed. It could be the same name as the article or something like "See more". This field is required if you link a page title.
  • Category: Select which category you would like your marker to be grouped in. Each marker must be associated with a category to better group similar markers.
  • Custom Marker Icon: Adds a custom icon to a specific map marker within a category. This overwrites the chosen icon for the category in general. The permitted file types are .svg, .png, and .jpg, and the icon size should be between 32x32px and 64x64px. Know that all markers pins are lined up at the bottom center, regardless of their shape. So if you use a round marker rather than a pin, you'll have to align it yourself at the bottom center and not the middle of the circle.

Once a marker is created, you can drag it to a different location on the Map if you so choose. You can also click on the marker and hover over the three vertical dots to bring up options to edit or delete the marker.

Additional Functions

Hovering over the button in the top right with the three vertical dots (⋮) will open a dropdown. Depending on your user rights, you will always get the option to "edit source", "history", and "move" the Map.

  • Edit source: Clicking this will take you out the visual Interactive Maps Editor and to the JSON code of the Map. If you wish to return to the visual Interactive Maps Editor, you need to exit the source mode and click the edit pencil on the Map again.
  • History: This will take you out of the editor and to the page history of the Map, showing you all edits and changes made by anyone and giving you the option to undo them if necessary.
  • Move: This will close the Interactive Maps Editor and take you to Special:MovePage, where you can choose a new name for your Map.

The following options are only available to those with the content moderator right or higher.

  • Protect: It opens the options for protecting your Map.
  • Delete: This will delete your Map. You can always restore it if you did this by accident.

As you are making edits, the preview window will display your changes in real time, so you can see how your Map will look before you save it. When you are finished, click the "Save" button, and your new Map will now appear on the wiki!

Building a Map using JSON in Source Editor

Every Interactive Map is defined in JSON (JavaScript Object Notation). The following fields should be defined in order to generate the Map:

  • mapImage (required, string) – Name of the file that will be used as the map background image (with or without the "File:" namespace prefix). The image must be uploaded to the wiki (e.g., using Special:Upload). The following file extensions are supported: .jpg / .jpeg / .png / .svg.
  • mapBounds (required, array[2][2] of number) – Bounds defining the edges of the map, given as a 2x2 matrix of numbers.
    • The first (lower) coordinate defines the minimum point at which marker positions will start (modified by origin, be it top-left or bottom-left), and the second (upper) coordinate defines the maximum point in the opposite corner (top-right if origin is "bottom-left", or bottom-right if origin is "top-left"). A marker at the first coordinate will always be positioned at the origin, which will always be in the top-left/bottom-left corner of the mapImage.
    • In a typical setup, the lower coordinate is [0, 0], and the upper coordinate is the size of the mapImage, or a size with an equivalent aspect ratio. While the bounds does not limit the resolution of the mapImage, it does affect the percieved minimum and maximum zoom level, as a map with a bounds of [[0, 0], [3840, 2160]], will appear twice the size at same zoom level as a map of an upper bound of [[0, 0], [1920, 1080]]. Scaling the bounds by a non-power-of-two will affect the default zoom and the size of each zoom step.
    • Bounds may be used to shift the coordinate system so that 0,0 is not the origin, which may be more meaningful for the coordinates on hand. For example if 0,0 should be the center of a map at a size of 1920x1080, mapBounds should be [[-960, -540], [960, 540]], and all original coordinates that were previously defined in a range of x 0-1920 and y 0-1080 should have half of the width and height subtracted from their x and y position accordingly.
    • The bounds is also used to define the aspect ratio of the background image, as the image will be stretched and squished to conform to the bounding box (not the other way around). It cannot be used to non-uniformly scale the coordinate system. In order to maintain the aspect ratio, the difference between the pairs of coordinates should always match the aspect ratio of the source mapImage, otherwise the image will appear stretched.
  • categories (optional, array of object) – List of categories that will be displayed in the filters list (the dropdown menu found in the top-left of the map).
  • markers (optional, array of object) – List of markers that will be displayed on the map. Each marker must be associated with a defined category.
  • origin (optional, string) – Location of the origin point [0,0] in the coordinate system.
    • Possible values: "bottom-left" (default) or "top-left".
  • pageCategories (optional, array of string) – Categories to include the map page in. For example, ["Foo", "Bar"] will put the map into the categories "Category:Foo" and "Category:Bar".
  • defaultSort (optional, string) – Used to change the default sort key, which influences the position that the map appears in category pages. If not present, the map is sorted using its page name (i.e. without the Map: namespace prefix).
  • description (optional, string) – Add a text description above your Map in the Map namespace to tell viewers as well as Google what this Map is about and how it fits into the context of your wiki. It will also feed future map search results. This field supports wikitext, and the character limit is 200.
  • coordinateOrder (optional, string) – Order of coordinates used in defining map bounds and marker positions.
    • Possible values: "xy" (default) or "yx".
  • useMarkerClustering (optional, boolean) – Used to enable or disable marker clustering.
    • Possible values: false (default) or true

Categories

Categories are a group of markers of the same kind. Each marker category is defined through the following fields:

  • id (required, string or number) – Uniquely defined ID for each category, matched with the categoryId property of each marker. Any string is valid as an "id".
  • listId (optional, number) – Category order as shown in the interactive editor and in the filters list.
  • name (required, string) – Name of the category, which will be displayed in the filters list.
  • color (required, string) – The color given to the default marker icon for markers in this category, which can be given in hex colors (3 or 6-digit notation only) or named colors. This field is ignored (but still required) if icon is present.
  • symbol (optional, string) – Add a single Unicode character or an emoji to the center of the default pin. The character may be represented either verbatim (by typing or pasting it into the field), or by using a JavaScript-escaped UTF-16 hex code in the format \u<hex> (see a list of example codes for emojis here. E.g., \ud83d\ude04 to generate 😄).
  • symbolColor (optional*, string) – When choosing a single character, you must specify its color using a hex code (e.g., #FF0000) or color name (e.g., red). Be mindful of accessibility and the contrast with the marker color. Note that when you edit the character later via the Interactive Maps Editor, the character color will automatically change to black or white depending on the marker's background color.
  • icon (optional, string) – Name of the file to be used as the icon of the category (with or without the "File:" namespace prefix), which will replace the default colored pin icon. The file used for the icon should be between 32x32px and 64x64px in size, and the allowed formats are .svg, .png, and .jpg. If present, the fields color, symbol, and symbolColor are ignored, although the color field still needs to be present and valid.

Markers

Each individual marker is defined through the following fields:

  • id (required, string or number) – A unique ID for each marker that can be used to link directly to a specific marker. The uniqueness of IDs is not enforced.
  • categoryId (required, string or number) – ID of the category associated to the marker. A category definition of this ID must be present in the categories array.
  • position (required, array[2] of number) – Coordinate position of the marker, within the given mapBounds and in the order defined by coordinateOrder, as an array of two numbers. A marker at the position [0, 0] will be shown at either the bottom-left or the top-left corner of the map, depending on the origin field. Note that due to a bug in the validation of this field, you cannot use an X coordinate less than the lower Y coordinate of mapBounds.
  • icon (optional, string) – Adds a custom icon to a specific map marker within a category. This overrides the chosen icon for the category in general. The permitted file types are .svg, .png, and .jpg, and the icon size should be between 32x32px and 64x64px.
  • popup (required, object) – Properties of the pop-up box that appears when a marker is clicked on:
    • title (required, string) – Title of the marker. Each marker title has a strict 50-character limit.
    • description (optional, string) – Description to be displayed in the pop-up. Each marker description supports wikitext, and has a strict 300-character limit (which applies only to the pre-parsed text). Escaped characters (\n, \", \', etc.) count as a single character.
    • link (optional, object) – Article link to be added to the pop-up. Marker links are optional, but if included, must be defined with both a url (the article title to be linked to) and a label (the link text to be displayed). The URL can link to both full articles and article sections. Interwiki links and external links are not supported (but they can be added in the Map Description field).
    • image (optional, string) – File name of the image to be shown in the popup (with or without the "File:" namespace prefix). The image will be placed under the title and description and above the link. The image is automatically sized to fit inside the popup container, at a width of 264px.

Example

{
	"mapImage": "File:MapBackground.jpg",
	"pageCategories": ["Maps"],
	"defaultSort": "",
	"coordinateOrder": "xy",
	"mapBounds": [[0, 0], [1000, 1000]],
	"origin": "bottom-left",
	"useMarkerClustering": true,
	"categories": [
		{ "id": "1", "name": "Artifacts", "color": "#ff00ff" },
		{ "id": "2", "name": "Dungeons", "color": "#00ff00" }
	],
	"markers": [
		{
			"categoryId": "1",
			"position": [500, 300],
			"popup": {
				"title": "A Sword",
				"description": "Very important artifact",
				"link": {
					"url": "Article about a sword",
					"label": "See more"
				},
                "image": "Example.jpg"
			},
			"id": "1" 
		},
		{
			"categoryId": "2",
			"position": [300, 500],
			"popup": {
				"title": "A Cave",
				"description": "Very scary dungeon",
				"link": {
					"url": "Article about a cave",
					"label": "See more"
				}
			},
			"id": "2" 
		}
	] 
}

Viewing a Map

Filters

Maps have a filters menu that allows them to show or hide a specific marker category, if you want to see only a specific one. Select "Select all" to show all map markers, or select specific categories to only see markers from that category.

Markers

Markers identify points of interest on the map, and can be selected to display the associated popup.

Markers are created in HTML in the same order in which they were created in the visual editor, or the order in which they are present in the markers array of the JSON. This influences the sort order; the Z-order that markers are displayed in from back-to-front. For example, a marker defined last in the JSON will overlap all other markers that may be surrounding it. It is common practice to sort markers by their Y position, in ascending order (when using an origin of top-left) or descending order (when using an origin of bottom-left), so that markers towards the top of the map are shown behind markers towards the bottom.

The marker order also influences the tab order; the order in which focus is cycled when pressing Tab (↹) and Shift-Tab.

Marker Clusters

For ease of display, markers may be grouped locally into clusters. This causes markers that are near to each other (at the current zoom level) to be grouped into a single node, which when clicked will zoom into that area and expand the cluster to reveal the markers underneath it. Hovering over a cluster will show an outline of the area of the markers contained within that cluster, with the number indicating the quantity.

Marker clustering may be enabled by toggling the "Marker Grouping" option to "on" in the Interactive Maps Editor, or with "useMarkerClustering": true in the JSON.

There is currently no way to adjust the sensitivity of the clustering.

Popups

Popups display more information about the marker, including a title, a description, image, and an optional link pointing to a relevant page. A popup can be shown by clicking on a marker, or pressing the enter/return key if a marker is focused. A popup can be dismissed by clicking anywhere on the map outside of the popup, by clicking on a marker to show a different popup, or by pressing the enter/return key. Only one popup can be displayed at a time.

A dropdown menu (⋮) in the corner of the popup can be clicked to display more information:

  • Copy link - Copies a link to the marker to the clipboard. When the link is followed, the map will zoom in to bring the marker into focus and will show its associated popup. See Linking to Markers for more information.
  • Report Marker - Reports the marker. See Reporting Markers for more information.

Other Features

  • Panning: The map can be panned/moved around by clicking and dragging anywhere within the the display area. Either left, middle, or right mouse button can be used. In addition, the arrow keys can be pressed to move the map cardinally in small 80px increments, or in larger 240px increments if the shift key is pressed. When the map is moved too far beyond the edge of the window, or such that a displayed popup is no longer in view, it will automatically snap back into view.
  • Zooming: The map can be zoomed in a variety of ways. Performing any momentary zoom action (with the exception of double-clicking and using the scroll wheel) while holding the shift key will zoom the map at a magnitude of 3x. By default each zoom step increases the magnification by ~1.41421306x.
    • By clicking the + and - buttons in the bottom right corner, which will zoom into the center of the map.
    • By pressing the plus (+) and minus (-) keys on your keyboard, likewise.
    • By scrolling with the mouse scroll wheel, which will zoom into the position under the cursor. This is affected by the "lines to scroll at a time" mouse setting in the operating system, at one more zoom step every 4 lines (caps at 8 steps).
    • By double clicking (to zoom in) and shift-double clicking (to zoom out), likewise.
    • By clicking and dragging the mouse while pressing the shift key, which will zoom the map to a specific rectangular area.
  • Edit: All maps will have a pencil icon in the top right. Clicking this will open the Interactive Maps Editor in a new tab, allowing it to be edited directly.

Maps and SEO

To ensure maximum discoverability and improve the SEO of your custom Maps through Google and other search engines, make sure to utilize the Map Description on each individual Map to its fullest potential. By adding a text description above your Map in the Map namespace, you can tell viewers as well as the search engine crawlers what this specific Map is about and how it fits into the context of your wiki. This field supports wikitext, and the character limit is 200.

In addition to adding descriptions to individual Maps, the Special:AllMaps page has a generic description that you can also customize to be more specific to your wiki. To do this, Template:Contact to change MediaWiki:All-maps-dashboard-description for you with the desired text.

Embedding a Map

To get more eyes on your Map, you can embed it into a mainspace article if you wish. Once the Map has been created, it can be transcluded into an article using the {{Map:My New Map}} wikitext syntax.

Like templates, more than one Map can be embedded in an article.

Aligning and Placement

By default, the map will take up 100% width of the containing element (i.e., if it's placed in the middle of an article, it will expand to the full width of the page). You can manipulate its placement by embedding it inside a <div> element or table, which allows you to specify alignment, width, and other properties. The height of the map is always 65% of the viewport height, or 500px if the viewport width is greater than 1280px. This height cannot be specified in wikitext, but may be changed in CSS with the rules .interactive-maps-container { height: inherit; } .interactive-maps-container .interactive-maps__map { height: 600px; }

Note that in order for a map inside such an element to fit in the article properly, it must be 530px wide or less.

For maps placed next to an infobox or other floating elements, the map will automatically shrink to fit within the free space. You can also force the embed to fit flexibly using style="display:flow-root" or style="overflow:hidden" in a surrounding div. Alternatively you can move it below floating elements (so that it appears after the infobox) with style="clear:both", or a <br clear="both"/> before the embed.

Maps can also be embedded in a tabber, which may be useful when displaying multiple maps on the same page without taking up too much vertical space. One such use case is for a series of maps that represent different floors in a building. Note, however, that Tabber is not supported on mobile, where the maps will be shown one above the other instead.

Also, you can place a Map inside an infobox, although this will greatly limit its functionality.

Linking to Markers

Map markers can be directly linked to by including the URL query parameter marker=marker_id in an external link to the map, where marker_id is the ID of the marker that should be displayed.

As an example, on the Avatar Wiki, the following link will link to a marker with the ID 42 on the Avatar world map: https://avatar.fandom.com/wiki/Map:Avatar_world_map?marker=42. This can be generated in wikitext using the fullurl magic word. For example:

This works when linking to the map page itself, or on any page where the map is embedded. If multiple maps exist on the page being linked to, the marker matching the ID across all embedded maps on said page will be focused, not just the first. If multiple markers exist with the same ID, linking to a marker using this ID may yield unexpected results.

Note that marker links can be used with a page anchor ('#'), as long as the anchor tag goes after the query string. However, the anchor will be ignored, and the map will be automatically scrolled to instead, assuming the marker ID is valid and the map is visible when the page loads. This may be used in a Tabber-embedded map to switch to the specific tab, scroll to the map (and not the start of the tab since maps override anchoring), and then focus on a marker at the same time (for example).

Reporting Markers

File:Reporting a Marker.png
Report option for logged-in users

Logged-in users can report a marker by clicking the three vertical dots (⋮) on the marker pop-up and selecting the "Report Marker" button. A successful report is indicated by a banner notification in the bottom left corner, and the "Report Marker" option in the menu will change to "Already Reported". This is only visible to the user who reported that marker. A previously dismissed marker cannot be reported again by the same user as long as the reports have not been cleared from Special:Reports. Trying this will result in the error message "There was a problem reporting this marker. Please try again."

Anonymous users cannot report a marker at all. While they see the "Report Marker" option, clicking that results in a pop-up prompting them to create an account.

If you wish to report a Map for deletion, you can do so by directly adding the relevant deletion category that your wiki uses to the Map. You can do that via the category module at the bottom of the page or by adding/updating the "pageCategories" in the JSON editor with the category name.

Reviewing Reports

Only administrators and content moderators will see any visible indicators that a marker has been reported and have the ability to address marker reports. The following moderation tools and report indicators will be available to them:

Special:Reports

Reported markers will appear on Special:Reports. This page can be found as a separate tab on Recent Changes, titled Map Reports, after the Image Activity tab. Anyone able to edit a Map can edit or even delete a reported marker, but only a saved edit or the deletion of the Map by a moderator will dismiss the report. Dismissed reports will remain visible (but grayed out) on this feed though will disappear after some time, depending on how much marker reporting activity the wiki sees. Active reports are visible indefinitely.

Viewing reported markers on Special:Reports, a moderator has the following options:

  • Review: Clicking this will take you to the Map in the Map namespace with the marker tooltip automatically opened. If the reported marker has been deleted in the meantime, you will just be taken to the Map, which should be an indicator for you to check the Map's history for marker deletion. The report for a deleted marker can only be removed by clicking "dismiss" on Special:Reports.
  • Dismiss: Dismissing a report from Special:Reports will gray out that entry and simultaneously dismiss all reports for that marker in case it was reported multiple times. You can still click on the title of the marker to be taken to the Map and have the tooltip open directly.

While Viewing a Map

When viewing a Map as a moderator, the following elements indicate that a marker has been reported:

File:Reported Markers.png
Reported pins are visually marked to moderators.
  • There will be an icon next to a marker or marker cluster. In case of the latter, the indicator icon will show the amount of markers inside the cluster that have been reported.
  • When opening a marker tooltip, there will be a bar message at the top saying "Reported by <Username>" or "Reported by <Username> and <number> others." Clicking on the username will take you to the reporter's profile page.
  • When accessing the marker menu via the three vertical dots (⋮) on a marker with active reports, there will be an option to "Dismiss Report" rather than "Report Marker".
  • After clicking "Dismiss Report" from the marker menu, a banner notification in the bottom left corner will indicate a successful dismissal, and the indicator and tooltip bar message will disappear.

Visual Interactive Maps Editor

When a moderator opens the visual Interactive Maps Editor, the report icons will remain visible next to the reported markers. When editing the Map via the JSON editor, there are no indications of which marker has been reported, and the moderator will have to search for the marker based on the marker's title.

CSS customization

Interactive Maps inherit many of the styles and colors from the Theme Designer. Should you wish to further change the look and feel of your maps, the following rules cover some common customizations that can be set in community CSS. Note that most of these rules apply to all maps on your wiki:

Change the background color of maps
Sets the background color shown behind the background image, both on the map page and in the Interactive Map Editor.

All skins:
.interactive-maps .leaflet-container,
.interactive-map-editor .leaflet-container {
    background-color: #000000;
}
Different color for light and dark mode:
.theme-fandomdesktop-light .interactive-maps .leaflet-container,
.theme-fandomdesktop-light .interactive-map-editor .leaflet-container {
    background-color: #ffffff;
}

.theme-fandomdesktop-dark .interactive-maps .leaflet-container,
.theme-fandomdesktop-dark .interactive-map-editor .leaflet-container {
    background-color: #000000;
}
Center custom marker icons
By default, icons are anchored to the bottom center of the coordinate. This means that the image appears above the coordinate and not centered on it, which may be an issue for maps that require precisely placed markers. The following CSS negates this offset for custom icons.

.MapMarker-module_markerCustomIcon__YfQnB {
    margin-top: -13px !important;
}

/* Adjust popup offset to account for the above. This will affect popups for default markers too! */
.leaflet-popup {
    margin-bottom: 8px;
}
Change the map height
Used to customize the height of all maps. The width is still 100% of the parent container.

Set the height to a fixed value (600px):
.interactive-maps-container {
    height: inherit;
    min-height: inherit;
}

.interactive-maps-container .interactive-maps__map {
    height: 600px;
}
Set the height of maps to a percentage (75%) of the viewport height:
.interactive-maps-container {
    height: inherit;
    min-height: inherit;
}

.interactive-maps-container .interactive-maps__map {
    height: 75vh;
}
Change the map width and height (per map)
Used to customize the width and height of an embedded/transcluded map.

CSS (place this in Common.css/FandomDesktop.css and FandomMobile.css):
.interactive-maps-size .interactive-maps-container {
    height: 100%;
    min-height: 100%;
}

/* Defaults which may be overridden with inline styles */
.interactive-maps-size {
    width: 100%;
    height: 65vh;
}

.interactive-maps-size .interactive-maps, 
.interactive-maps-size .interactive-maps-container > [class^="interactive-map-"],
.interactive-maps-size .interactive-maps-container .interactive-maps__map {
    height: inherit;
}

.interactive-maps-size .interactive-maps {
    display: flex;
    flex-direction: column;
}

.interactive-maps-size .interactive-maps__filters-list + div {
    flex-grow: 1;
}

/* The following styles are only used on mobile, and may be omitted from desktop CSS */

.interactive-maps-size .interactive-maps-container--fandom-mobile {
    overflow: visible;
}

.interactive-maps-size .interactive-maps-container--fandom-mobile .interactive-maps__filters-list {
    order: 1;
}

.interactive-maps-size .interactive-maps-container--fandom-mobile .interactive-maps__toggle-filters {
    position: relative;
}

.interactive-maps-size .interactive-maps-container--fandom-mobile .interactive-maps__toggle-filters-list {
    padding-top: 12px;
    position: absolute;
    width: 100%;
    top: calc(100% + 1.5em);
    background-color: var(--theme-page-background-color--secondary);
    border: 1px solid var(--theme-border-color);
    border-radius: 3px;
    z-index: 1;
}
Which is implemented in wikitext as follows. If a dimension is missing from the inline style, it will use the defaults of 100% (for width) or 65vh (for height). These can be set above.
<div class="interactive-maps-size" style="width: 300px; height: 300px">{{Map:My map}}</div>
Minimal layout (desktop only)
An alternate minimal layout which removes the padding around the map and places the filters on top of the map as a semi-transparent overlay.

.interactive-maps-container {
    padding: 0;
    height: inherit;
    min-height: inherit;
}

.interactive-maps__map {
    border-radius: 0;
}

.interactive-maps > .interactive-maps__filters-list {
    width: fit-content;
    margin: 12px 0 0 12px;
    position: absolute;
    z-index: 2;
}

.interactive-maps__filters-list .wds-pill-button {
    background-color: rgba(var(--theme-page-background-color--rgb), 0.75);
    box-shadow: 0 1px 3px 0 rgb(14 25 26 / 30%);
}

.interactive-maps__filters-list .wds-pill-button:hover {
    box-shadow: inset 0 0 18px 36px hsl(0deg 0% 100% / 10%);
}

Fetching map data in Lua and JavaScript

You might have a need to process the data from a map in other parts of your wiki.

Lua

In Scribunto Lua, use a combination of the mw.title and mw.text libraries to fetch the unparsed content of a map page (the JSON), and decode it to a Lua table:

local mapData = mw.text.jsonDecode(mw.title.new("Map:My Map"):getContent())

JavaScript (on Map pages)

In JavaScript, you can get a JavaScript object (the parsed JSON, with additional fields) of each map on the current page with the interactiveMaps property in mw.config. Each value in this object is keyed by an ID which is unique to the map definition on the page, but not unique to each instance on the page (i.e. a map transcluded multiple times on the page will use the same ID).

You can search for a map with a specific name as follows.

var mapData = Object.values(mw.config.get("interactiveMaps")).find(function(m){ return m.name == "My Map"; });

JavaScript (anywhere)

If the map isn't transcluded on the page, you can fetch the data with any of the following:

The following examples show a (very) minimal way of doing this. You may wish to add error checking on the fetch response to ensure it contains the actual data.

Using action=raw:

var url = "https://avatar.fandom.com/wiki/Map:Avatar_world_map?action=raw"
fetch(url).then(function(r){ return r.json(); })
.then(function(mapData) {
    // Do something with the map data here
});

Using getmap API:

var url = "https://avatar.fandom.com/api.php?action=getmap&name=Avatar_world_map"
fetch(url).then(function(r){ return r.json(); })
.then(function(mapData) {
    // Do something with the map data here
});

Using query API:

var url = "https://avatar.fandom.com/api.php?action=query&prop=revisions&rvprop=content&rvslots=main&titles=Map:Avatar_world_map"
fetch(url).then(function(r){ return r.json(); })
.then(function(r) {
    var mapData = JSON.parse(r.query.pages[0].revisions[0].slots.main.content);
    // Do something with the map data here
});

Useful links

  • First announcement of Interactive Maps
  • 2022 update for Interactive Maps
  • Full launch of Interactive Maps
  • A blog with notes about updates made to Maps

Map examples

  • Avatar Wiki: One of the first maps created using Interactive Maps
  • Escape from Tarkov Wiki: Highly customized maps, showing whats possible beyond the standard
  • Forgotten Realms Wiki: An extremely detailed map with over 1,200 markers, pushing the limits of what's possible with Maps
  • Need for Speed Wiki: An example of one of the first communities to make use of custom markers and map descriptions
  • Pillars of Eternity Wiki: Over 200 comprehensive maps
  • Starlancer Wiki: An unorthodox use of Maps to create a starship diagram
  • Warriors Wiki: Another interesting use of maps as a timeline for a series of books
  • Addams Family Wiki: An example of Family Tree maps

See also

  • Help:ImageMap, a default MediaWiki extension for embedding maps based on image coordinates.
  • Help:Maps Extension, a default MediaWiki extension for embedding real-world maps.

Further help and feedback

Template:Help and feedback section

  • Ask for help and give feedback on Interactive Maps in the #maps channel of the official Fandom Discord.

de:Hilfe:Interaktive Karten es:Ayuda:Mapas interactivos fr:Aide:Cartes interactives id:Bantuan:Peta Interaktif it:Aiuto:Mappe Interattive pl:Pomoc:Interaktywne mapy pt:Ajuda:Mapas Interativos ru:Справка:Интерактивные карты tr:Yardım:Etkileşimli Haritalar uk:Довідка:Інтерактивні мапи zh:Help:互動式地圖 ko:도움말:대화형 지도