Template talk:Location map many

From Wikipedia, the free encyclopedia

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

Contents

[edit] Created

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)

[edit] Allows multiple defaults

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)

[edit] Parameter checking

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.

[edit] Implementation notes

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

[edit] Tedious template-coding

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.

[edit] Statement syntax

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)

[edit] Template debugging

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)

[edit] Other issues

[ Discuss other unnamed issues here. ]

[edit] Template fails with 6+ locations?

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)

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)

[edit] Suppressing markers

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)

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)
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)