Template:Map compare/doc
This is a documentation subpage for Template:Map compare. It contains usage information, categories and other content or metadata that is not part of the original template. |
Embeds an interactive comparison between two maps based on {{Vector map}}. Drag the scrubber left and right to reveal more of one map or the other.
Usage
{{Map compare|lat=39.10599|lon=-84.5291|zoom=14|marker=no|layer=carto|layer2=baremaps}}
{{Map compare|lat=39.27541|lon=-84.28405|zoom=14|marker=no|layer=historic|date=1992-08-01|date2=2024-11-23}}
Parameters
This template supports all of the parameters of {{Vector map}}, with the addition of:
- |layer2 =
- The map layer to display on the right-hand side of the comparison. Defaults to the value of |layer =, which is always used on the left-hand side.
- |date2 =
- An ISO 8601-1 date by which to filter the data on the right-hand side of the comparison. Defaults to the value of |date =, which is always used on the left-hand side.
Additionally, |width = defaults to full
(occupying the available space) instead of 400 pixels.
Implementation
This template simply inserts a placeholder <div>
tag containing two transclusions of {{Vector map}}. MediaWiki:Gadget-maps.js, which is enabled by default for all users, detects this placeholder and responds by installing MapLibre GL Compare, which populates the placeholder with an interactive map copmarison. MapLibre GL Compare is loaded lazily from MediaWiki:Gadget-maplibre-gl-compare.js and MediaWiki:Gadget-maplibre-gl-compare.css, if and only if the page contains this placeholder, and only once even if there are multiple placeholders.
Template data
Embeds an interactive comparison between two vector maps. Drag the scrubber left and right to reveal more of one map or the other.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Latitude | lat | Initial center latitude. Defaults to 0 degrees (equator).
| Line | suggested |
Longitude | lon | Initial center longitude. Defaults to 0 degrees (prime meridian).
| Line | suggested |
Zoom level | zoom | Initial vector zoom level. A vector zoom level is one less than a conventional raster zoom level seen in Leaflet-based websites such as openstreetmap.org or openhistoricalmap.org. May be a fractional number such as 10.5. Defaults to 11.
| Number | optional |
Bearing | bearing | Initial bearing in degrees counterclockwise from north. Defaults to 0 degrees (due north).
| Number | optional |
Pitch | pitch | Initial pitch in degrees away from the plane of the screen. Defaults to 0 degrees (lying flat on the screen).
| Number | optional |
Width | width | Width of the map in pixels. “full” fits available space. Defaults to “full”.
| Line | optional |
Height | height | Height of the map in pixels. Defaults to 400 pixels.
| Line | optional |
Left layer | layer | The map layer to display on the left-hand side of the comparison. Defaults to “baremaps” (as in Apache Baremaps, which develops a vector port of OpenStreetMap Carto called OpenStreetMap Vecto).
| Line | optional |
Right layer | layer2 | The map layer to display on the right-hand side of the comparison. Defaults to the value of “layer”, which is always used on the left-hand side.
| Line | optional |
Left date | date | An ISO 8601-1 date by which to filter the data on the left-hand side of the comparison. Any map feature must have existed by this date to appear. Only supported when “layer” is set to an OpenHistoricalMap-based stylesheet; ignored otherwise.
| Date | optional |
Right date | date2 | An ISO 8601-1 date by which to filter the data on the right-hand side of the comparison. Defaults to the value of “date”, which is always used on the left-hand side.
| Date | optional |
Commons | commons | The page name of a GeoJSON map data file on Wikimedia Commons to load as an overlay. Include the .map file extension but exclude the Data: namespace.
| Line | optional |
Marker | marker | By default, a marker appears at the location specified by “lat” and “lon”. Set to “no” to hide this marker.
| Boolean | optional |
Marker latitude | mlat | Latitude at which to place the marker. Defaults to the value of “lat”.
| Number | optional |
Marker longitude | mlon | Longitude at which to place the marker. Defaults to the value of “lon”.
| Number | optional |
Left attribution position | attribution-position | Corner of the left-hand side’s map in which the attribution control appears.
| Line | optional |
Right attribution position | attribution-position2 | Corner of the right-hand side’s map in which the attribution control appears.
| Line | optional |
See also
- {{Vector map}}
- Module:CarouselMap – inserts a similar comparison based on a rotating configuration