Extension:GoogleMapsFn

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
GoogleMapsFn

Release status: beta

Implementation Parser function
Description Provides a parser function to view or edit Google Maps
Author(s) Dmitriy Sintsov <questpc@rambler.ru> (QuestPCtalk)
Last version 0.2.0 (March 2013)
MediaWiki 1.18wmf1 (does not work in 1.18.2), 1.21wmf8
Database changes no
License GNU GPL
Download from github

Project page

Git [Help]
Commit history
Note:
No localisation updates are provided by translatewiki.net.

Check usage and version matrix

The GoogleMapsFn extension defines a parser function that uses Google Maps v3 api to display maps embedded into wiki pages. Optional argument of parser function may be used to display editor, which allows to change map properties as well as to add markers and their descriptions.

Contents

Function [edit]

Just one function is defined googlemap. Below is the list of named function parameters. Unnamed function parameters are used to define marker position and description (see below).

Parameter name Parameter description Parameter type
lat Latitude of map central point Floating point number in range [-90..90]
lng Longitude of map central point Floating point number in range [-180..180]
zoom Initial value of map zoom Integer number in range [0..21]
align Optional alignment of the map container String left or right. The default alignment is right, just as for the images.
width Width of map container Number of px, em or % (default is px, when units name is omitted)
height Height of map container Number of px or em (default is px, when units name is omitted)
caption Optional caption of the map Wikitext (can be multiline)
searchbox Optional SearchBox Integer 1 to turn on places SearchBox
edit Optional map edit mode Integer 1 to turn on map editor
Unnamed parameter Definition of marker lat, lng description, where lat / lng are floating point numbers and description is multiline wikitext
When entering source wikitext of tag manually, do not forget to escape pipe character in some way. When entering description in the editor, non-lexical vertical pipe characters will be escaped automatically.

Examples [edit]

In active edit mode:

{{#googlemap:
lat=55.773882
|lng=37.615879
|zoom=16
|searchbox=1
|width=675
|height=250
|caption=Hello, [[world]]!
* How
* are
* you?
|edit=1
|55.774195, 37.617209 Entrance [[from one side]]

There can be paragraphs.

|55.777096, 37.627416  Exit [[into another side]]

Yet another paragraph.
}}

View-only mode:

{{#googlemap:lat=45.773882|lng=27.615879|align=left|zoom=12|searchbox = 1|width=  100%  |height=  20em  |caption=Romanian cities
|45.774195, 27.617209 One [[point]]

yet another [[paragraph]].

|45.777096, 27.627416 There could be some [[entrance]].
}}

Download [edit]

If you are familiar with git, current master can be cloned via the following shell command:

git clone git://github.com/Dmitri-Sintsov/MW-GoogleMapsFn.git

Otherwise, you may download the latest snapshot from github.

The project page is located here.

Installation [edit]

Move or copy folder 'GoogleMapsFn/' into 'extensions/' directory of MediaWiki installation. Place the following line into LocalSettings.php:

require_once( "$IP/extensions/GoogleMapsFn/GoogleMapsFn.php" );

See also [edit]