Module:Coordinates/doc

From Wikimedia Commons, the free media repository
Jump to: navigation, search

CodeDiscussionEditHistoryNo test API DocumentationSubpagesLinksTestsResultsSandbox All modules

This is the documentation page for Module:Coordinates

Dialog-warning-orange.svg Note: This module is used on a lot of pages. In order not to put too much load on the servers, edits should be kept to a bare minimum. Please discuss proposed changes on the talk page first.
  • Editing a module causes all pages that use the module to be re-rendered. If the module is used often, this can put a lot of load on the servers since it fills up the job queue.
  • Keep in mind that templates that are used on file description pages also show up on other wikis.

Careful, this function is live, and called by {{Location}} template. The documentation might not be complete

This module provides most of the logic behind {{location}} and related geolocation templates. It provides several methods visible to the templates:

  • {{#Invoke:Coordinates | parseAttribute| attribute string | attribute name }} : parse {{location}} attribute parameter attribute string and return value of the attribute name parameter
  • {{#Invoke:Coordinates | getHeader| attribute string }} : parse {{location}} attribute parameter attribute string and return the numeric value of the header attribute.
  • {{#Invoke:Coordinates | GeoHack_link| lat=... | lon=... |lang=xx | site=... | globe=... }}: creates link to GeoHack tool and display location coordinates. The URLs are based on website and latitude/longitude coordinates. Language is used so it can be passes to the website. Globe parameter is used to allow specifying coordinates on planets other than earth.
  • {{#Invoke:Coordinates | lat_lon| lat=... | lon=... |lang=xx }}: create coordinate location string based on decimal degrees latitude and longitude number. Language is used to localize the presentation of the numbers.
  • {{#Invoke:Coordinates | deg2dms| degrees|lang=xx }}: create dms (degree/minute/second) string based on decimal degrees number. Language is used to localize the presentation of the numbers.
  • {{#Invoke:Coordinates | externalLink| site=... | globe=... | lat=... | lon=... |lang=xx }}: create URLs for different sites which are used by coordinate location templates. The URLs are based on website and latitude/longitude coordinates. Language is used so it can be passes to the website. Globe parameter is used to allow specifying coordinates on planets other than earth.

Examples[edit]

Functions:

  • deg2dms(degree, degree_precision, language)
  • {{#invoke:Coordinates| deg2dms | 12.3456789}} will display "12° 20′ 44.44″"
  • {{#invoke:Coordinates| deg2dms | 12.3456789 |1}} will display "12°"
  • {{#invoke:Coordinates| deg2dms | 12.3456789 |1e-1}} will display "12° 21′"
  • {{#invoke:Coordinates| deg2dms | 12.3456789 |1e-3}} will display "12° 20′ 44″"
  • {{#invoke:Coordinates| deg2dms | 12.3456789 |1e-4}} will display "12° 20′ 44.4″"
  • {{#invoke:Coordinates| deg2dms | 12.3456789 |1e-5}} will display "12° 20′ 44.44″"
  • lat_lon
  • {{#invoke:Coordinates| lat_lon | lat=51.48 | lon=0}} will display "51° 28′ 48″ N, 0° 00′ 00″ E"
  • GeoHack_link
  • externalLinksSection
    {{#invoke:Coordinates| externalLinksSection | globe = Earth| lat=51.48 | lon=0 | lang=en | namespace=File}} displays "OpenStreetMap - Google Earth"
  • {{#invoke:Coordinates| externalLinksSection | globe = Earth| lat=51.48 | lon=0 | lang=en | namespace=Category}} displays "OpenStreetMap - Google Earth - Proximityrama"
  • {{#invoke:Coordinates| externalLinksSection | globe = Earth| lat=51.48 | lon=0 | lang=ru | namespace=Category}} displays "OpenStreetMap - Google Планете Земля - Proximityrama"
  • {{#invoke:Coordinates| externalLinksSection | globe = Mars| lat=51.48 | lon=0 | lang=en | namespace=File}} displays "Google Maps"
  • {{#invoke:Coordinates| externalLinksSection | globe = Moon| lat=51.48 | lon=0 | lang=en | namespace=File}} displays "Google Maps"
  • LocationTemplateCore

See testcases to see more examples.

Dependencies[edit]

Relies on Module:I18n/coordinates for all of the internationalization translations.