Jump to content

Extension:GoogleMapsFn: Difference between revisions

From mediawiki.org
Content deleted Content added
chg
mNo edit summary
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Archived extension|1782366|Maps}}
{{Extension
|name = GoogleMapsFn
|status = beta
|type1 = parser function
|license = GNU GPL
|username = QuestPC
|author = Dmitriy Sintsov <questpc@rambler.ru>
|description = Provides a parser function to view or edit Google Maps
|version = 0.1.1
|update = May 2012
|mediawiki = 1.18wmf1, 1.20 master (does not work in 1.18.2)
|download = [[#Download|from github]]
{{GithubDownload|Dmitri-Sintsov|MW-GoogleMapsFn}}
|needs-updatephp = no
|readme =
|changelog =
}}
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.

== Function ==
Just one function is defined <tt>googlemap</tt>. Below is the list of named function parameters. Unnamed function parameters are used to define marker position and description ([[#Examples|see below]]).

{|class="wikitable"
! 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)
|-
| 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<br />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 ==
In active edit mode:
<pre>
{{#googlemap:
lat=55.773882
|lng=37.615879
|zoom=16
|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.
}}
</pre>

View-only mode:
<pre>
{{#googlemap:lat=45.773882|lng=27.615879|align=left|zoom=12|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]].
}}</pre>

== Download ==

If you are familiar with git, current master can be cloned via the following shell command:
<pre>
git clone git://github.com/Dmitri-Sintsov/MW-GoogleMapsFn.git
</pre>

Otherwise, you may download the latest snapshot from [https://github.com/Dmitri-Sintsov/MW-GoogleMapsFn/zipball/master github].

The project page is located [https://github.com/Dmitri-Sintsov/MW-GoogleMapsFn here].

== Installation ==
Move or copy folder 'GoogleMapsFn/' into 'extensions/' directory of MediaWiki installation. Place the following line into LocalSettings.php:
<pre>
require_once( "$IP/extensions/GoogleMapsFn/GoogleMapsFn.php" );
</pre>

== See also ==
* [[Extension:Semantic Maps|Semantic Maps]]
* [[Extension:Google Maps|Google Maps]] - A non-semantic Google Maps extension.
* [[Extension:YandexMaps]] - maps from yandex.com

[[Category:Map extensions]]
[[Category:Google extensions]]
[[Category:Geocode extensions]]

Latest revision as of 22:02, 26 December 2020