GeoHack

GeoHack is a modified version of the map sources from the gis extension by Egil Kvaleberg. It is designed to do simple HTML replacements of a template on Wikipedia and serve it to the client. It is used by Wikipedia for provide links to various mapping services

A different layouts designs for are listed on w:Template:GeoTemplate/sandbox.

Query

 * language
 * Set the sub-domain for the request,


 * pagename
 * Name of the article on Wikipedia. If not supplied will attempt to read the values from the HTTP referer.


 * params
 * See params below.


 * title
 * If the page is a not an appropriate title such as when referring to a location in the article set this.


 * project=osm
 * Request a the page for OpenStreetMaps maps: http://wiki.openstreetmap.org/wiki/Template:GeoTemplate-en

params
The D_M_S_N_D_M_S_E, D_M_N_D_M_E, D_N_D_E, or D;D where D is degrees, M is minutes, S is seconds, and NS/EWO are the directions


 * default&#58;
 * default scale: for use in templates, is overridden by dim:, scale:, type: parameters.


 * dim&#58;
 * specify the size of the object in meters. The value is converted into a scale: with an assumed view port 10 cm by 10 cm.


 * globe&#58;
 * Specify globe other than earth, argument value is used as the subpage name, for example globe:moon will call w:Template:GeoTemplate/moon


 * page&#58;
 * (disabled) specify a subpage for map sources


 * region&#58;
 * ... If not supplied GeoHack will attempt to find the region using the coordinates.


 * scale&#58;
 * Set the relative map scale as 1:N. A standard 72 dpi screen pixel density is assume for the measurement.  Scale is inherited from the type by can also be set directly.


 * type&#58;
 * The following are types GeoHack recognizes along with the calculate scale.

Replacement variables

 * WGS84 Positioning
 * {latdegdec}, {londegdec} - Decimal degrees
 * {latdegdecabs}, {londegdecabs} - Absolute decimal degrees (no negative)
 * {latdeground}, {londeground} - Rounded integer degrees
 * {latdegroundabs}, {londegroundabs} - Rounded absolute
 * {latdeg_outer_abs}, {londeg_outer_abs} - Absolute integer degrees rounded up
 * {latdegabs}, {londegabs} - Absolute integer degrees


 * {latantipodes}, {longantipodes} - Antipodes of {latdegdec}, {londegdec}
 * {londegneg} - The negative of {londegdec}
 * {latdegint}, {londegint}</tt> - Integer degrees (floored)
 * {latmindec}, {lonmindec}</tt> - Decimal minutes
 * {latminint}, {lonminint}</tt> - Integer minutes
 * {latsecdec}, {lonsecdec}</tt> - Decimal seconds
 * {latsecint}, {lonsecint}</tt> - Integer seconds
 * {latNS}, {lonEW}</tt> - Direction of absolute integer degrees
 * UTM Positioning
 * {utmnorthing}, {utmeasting}, {utmzone}</tt>
 * {utm33northing}, {utm33easting}</tt>
 * Ordnance Survey Grid Positioning
 * {osgb36ref}</tt>
 * {osgb36northing}, {osgb36easting}</tt>
 * CH1903 Positioning
 * {ch1903northing}, {ch1903easting}</tt>


 * Scaling


 * Geographical features
 * {type}, {region}, {globe}</tt> - The parameters from the . Globe not very useful due to the subpaging scheme.


 * Coordinate title
 * {pagename} - Underscore page name, as given by the pagename or determined by the HTTP referrer.
 * {title} - Title of the location as given by title, if not specified then falls back to {pagename} with the underscore replaced with spaces.


 * Misc./Not fully implemented
 * {page} - Deprecated
 * {geocountry} - same as region:
 * {geoa1} - Characters 4 to 8 of region; Uppercased

Section codes
If the region is supplied or determined then GeoHack moves the section to the placeholder:

The region sections are wrapped in the divs where XX of the id is the ISO 3166-1 alpha-2 code:

A surrounding div can style this section or the local div can provide only local links. To save bandwidth and simplify the REGIONS div will be removed if a local section is found.

JavaScript
To for user modifications and development, JavaScript is loaded from the local language's  page see English Wikipedia for an example.

Known issues

 * See bug tracker at https://jira.toolserver.org/browse/GeoHack


 * GeoHack occasionally gets gzip encoded page which it will output as junk characters, this is caused by MediaWiki gzip cache bug. Typically purging the page will fix the problem.

Maintainers

 * en:User:Magnus Manske
 * de:Benutzer:Kolossos
 * en:User:Dispenser