Jump to content

Template:ParseWDCoords/doc

Kufuma Wikipedia

This template parses the output from a wikidata fetch operation (e.g. {{#property:P625}}
String format = 99°[99'[99"]] A 999°[99'[99"]]) and parses it into its 8 constituents

  1. latitude degrees
  2. latitude minutes
  3. latitude seconds
  4. latitide hemisphere (N or S)
  5. longitude degrees
  6. longitude minutes
  7. longitude seconsd
  8. longitude hemisphere (E or W)
Notes
  • Even though it was designed for output from wikidata, any character string with the correct format may be parsed. It is assumed that minutes (seconds) occur in pairs - so either both coordinate minutes (seconds) are present or neither is. Although seconds ought not appear without minutes, this rule is immaterial for this routine.
  • Output from wikidata contains the actual character string ' rather than literal apostrophe ' or any other symbol for arcminutes
  • Output from wikidata contains the actual character string " rather than literal quotes " or any other symbol for arcseconds
  • Template is invoked with two unnamed parameters:
    • |1=number of element to return from list above (1–8)
    • |2=optional character string – default is {{#property:P625}}

Example: Working on 89°39'48"N, 123°52'1"E gives:

  • S1 latd= 89
  • S2 latm= 39
  • S3 lats= 48
  • S4 latNS= N
  • S5 longd= 123
  • S6 longm= 52
  • S7 longs= 1
  • S8 longEW= E