Template:HybridMapLink

From Wikipedia, the free encyclopedia

[edit] Template documentation

This template provides a direct external link to satellite imagery or aerial photography with a map overlay, often referred to as "hybrid" mode. The link is randomly selected from one of the following sites: Google Maps, Live Search Maps, MapQuest, Multimap, WikiMapia or Yahoo! Maps. The only required parameters are the latitude and longitude in decimal degrees.

This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages.
Remember that you can conduct experiments, and should test all improvements, in either the local /test or your user space before changing anything here.

Contents

[edit] Usage

{{HybridMapLink|latitude|longitude|zoom}}

[edit] Parameters

lat or 1st unnamed parameter
Longitude in decimal degrees
lon or 2nd unnamed parameter
Longitude in decimal degrees
(optional) zoom or 3rd unnamed parameter
Zoom level from 1 (far) to 18 (close). This is the value used by Google Maps, Live Search Maps and WikiMapia; the template converts it to an equivalent value for other mapping sites (see the table below for details). Be careful using values over 13, since some areas and/or mapping sites do not have imagery available above that level. If not specified, zoom defaults to 13.
Although this parameter is optional, it is suggested that it be included in case the default value is changed in the future.
(optional) mapquest or mq
The MapQuest site is not enabled by default because it only displays satellite imagery for locations in North America. To enable MapQuest as one of the randomly selected sites, simply define this parameter with any value.
(optional) seed
Used when adding template more than once in an article, to prevent all links from using same mapping site (see example below).

[edit] Examples

Each example shows the template code followed by the output. The mapping site names displayed after each link are not part of the template's output; they are added here for information purposes.

To see how these examples generate a link to a randomly chosen site, clear your browser cache and then refresh your browser window. If that does not work, you can also purge this page.

[edit] Using unnamed parameters

This example never generates a MapQuest link since the mapquest parameter is not defined.

Template: {{HybridMapLink|40.6397|-73.7789|13}}
Output:

[edit] Using named parameters

This example never generates a MapQuest link since the mapquest parameter is not defined.

Template: {{HybridMapLink|lat=40.6397|lon=-73.7789|zoom=13}}
Output:

[edit] Using the mapquest parameter

This example will occasionally generate a MapQuest link since the mapquest parameter is defined.

Template: {{HybridMapLink|lat=40.6397|lon=-73.7789|zoom=13|mapquest=y}}
Output:

[edit] Using the seed parameter

This example shows how multiple instances of the template can be made to use different mapping sites. Be sure to use different seed values for each link. Although the example shows all six mapping sites, the order is random.

Template:

{{HybridMapLink|40.6397|-73.7789|13|mq=y|seed=1}}
{{HybridMapLink|40.6397|-73.7789|13|mq=y|seed=2}}
{{HybridMapLink|40.6397|-73.7789|13|mq=y|seed=3}}
{{HybridMapLink|40.6397|-73.7789|13|mq=y|seed=4}}
{{HybridMapLink|40.6397|-73.7789|13|mq=y|seed=5}}
{{HybridMapLink|40.6397|-73.7789|13|mq=y|seed=6}}

Output:

Without the seed parameter, multiple instances all use the same web site.

Template:

{{HybridMapLink|40.6397|-73.7789|13|mq=y}}
{{HybridMapLink|40.6397|-73.7789|13|mq=y}}
{{HybridMapLink|40.6397|-73.7789|13|mq=y}}

Output:

[edit] Testing

The external links should all be tested to ensure that an image is displayed regardless of which web site is randomly selected. This is of particular importance when setting the zoom parameter higher than 13 or using the mapquest (mq) parameter to enable MapQuest. The {{HybridMapLink/test}} template was designed to assist with this task.

When previewing an edit, use:

Template: {{HybridMapLink/test|40.6397|-73.7789|16}}
Output:

Prior to saving the article, remove /test (this example also enables MapQuest):

Template: {{HybridMapLink|40.6397|-73.7789|16|mq=y}}
Output:

[edit] Equivalent zoom values

The first column of this chart shows acceptable values for the zoom parameter, as used by Google Maps, Live Search Maps and WikiMapia. The remaining columns show how that value is converted for other sites. The row containing the default values is highlighted in yellow.

Note that MapQuest has a smaller range of zoom levels, therefore some lower values of the zoom parameter have no MapQuest equivalent; these are marked "n/a" followed by the value the template uses for the conversion.

Google Maps
Live Search Maps
WikiMapia
Multimap
Yahoo! Maps
MapQuest
1 2 n/a (use 0)
2 3 0
3 4 1
4 5 n/a (use 1)
5 6 2
6 7 n/a (use 2)
7 8 3
8 9 4
9 10 5
10 11 6
11 12 7
12 13 8
13 14 9
14 15 10
15 16 11
16 17 12
17 18 13
18 19 14

[edit] Error checking

[edit] No zoom value

These examples should display correctly.

Template: {{HybridMapLink|40.6397|-73.7789}}
Output:
Template: {{HybridMapLink|40.6397|-73.7789|seed=1}}
Output:

[edit] Empty zoom value

These examples should display correctly.

Template: {{HybridMapLink|40.6397|-73.7789|}}
Output:
Template: {{HybridMapLink|lat=40.6397|lon=-73.7789|zoom=}}
Output:
Template: {{HybridMapLink|40.6397|-73.7789||seed=1}}
Output:

[edit] Invalid zoom value

These examples should display an error message.

Template: {{HybridMapLink|40.6397|-73.7789|0}}
Output:
  • Error: Zoom value outside acceptable range of 1 through 18
Template: {{HybridMapLink|lat=40.6397|lon=-73.7789|zoom=19}}
Output:
  • Error: Zoom value outside acceptable range of 1 through 18
Template: {{HybridMapLink|40.6397|-73.7789|20|seed=1}}
Output:
  • Error: Zoom value outside acceptable range of 1 through 18