GeoMath extension

License
GPL.

Usage
The GeoMath extension is part of the MapSources extension. The GeoMath extension implements the following functions:

dd2dms

 * dd2dms converts degrees to degree-minute-second format. It uses the required coordinate and the optional plus, minus and precision values.
 * Application:
 * Example:  gives
 * Example:  gives

Degree values can be both sexagesimal and decimal.

Strings for the cardial directions will be added to the dms value. They can be empty, single letters or strings and will be added at the end of the conversion result. If the original value is graeter or equal zero, the plus string is added, otherwise the minus string is used.

deg2dd

 * deg2dd converts degrees to decimal-degree format.
 * Application:
 * Example:  gives

geoLink
The third function, geoLink, can be used to convert a complete geographic coordinate without reapplying the dd2dms function:


 * geoLink replaces a string pattern with coordinates.
 * Application:

The following example shows how to write a template showing a text link to a Map Sources special page:

The pattern string can obtain upto four different place holders $1 ... $6.


 * $1 means the latitude in Wikipedia syntax including the direction letter like 51.2323_N.
 * $2 means the longitude in Wikipedia syntax including the direction letter like 51.2323_E.
 * $3 means the latitude in degree, minute and second format considering the strings for the cardinal directions and the precision, see also dd2dms.
 * $4 means the longitude in degree, minute and second format considering the strings for the cardinal directions and the precision, see also dd2dms.
 * $5 means the latitude.
 * $6 means the longitude.

Sexagesimal coordinate format
You can enter coordinates in the sexagesimal system in the following way:

deg[°] [min['] [sec[ '' ]]] [N|S|E|W]

deg, min, sec mean the degree, minute and second values, respectively. The designations can be omitted, but the succession must be kept.

There are alternative characters for the designations in the following way:

Installing GeoMath
Donwload from mediawiki/trunk/extensions/GeoMath. Copy GeoMath.php into the GeoMath folder in the extensions folder of your MediaWiki installation. Then add the following line to your LocalSettings.php file (near the end):

Used messages
Message strings ― noted in GeoMath.i18n.php ― are available now for three languages (de, en, and pl).

Updates

 * 2007/11/21: Polish strings added

de:Vorlage:Coord DD to DMS