Extension:GooglePlaces

The GooglePlaces extension uses parser functions to pull data from the Google Places API into wiki pages. This extension is not for the faint of heart. Its focus is on functionality and not on ease of use. It works well, but a fair amount of knowledge about the Google Places API is required to get full use of this extension. Basic users can still copy the examples below.

Configuration parameters

 * $wgGooglePlacesAPIKey: (Required) Your API key from Google
 * $wgGooglePlacesExpiry: How long to cache the API lookups. Defaults to 10 minutes.

The parser function
The  parser function allows you to look up a place's details based on that place's Google Place ID. It takes two unnamed parameters.
 * 1) The first parameter is the Place ID. You can look that up using this page.
 * 2) The second parameter is the path through the API's response that contains the information you need, with each level separated by a  . This page contains information about the fields that the API sends.

Examples

 * → Wikimedia Foundation Inc.
 * → SF
 * → CA
 * → 149 New Montgomery Street, San Francisco, CA 94105, United States
 * → (415) 839-6885
 * → 37.786997, -122.399695
 * → 4.4
 * → http://wikimediafoundation.org/
 * → 149 New Montgomery Street, San Francisco , CA 94105 , United States
 * → Monday: 9:00 am – 5:00 pm

The parser function
The  parser function allows you to retrieve particular components of the   API response. It takes two or three unnamed parameters:
 * 1) The first parameter is the Place ID. You can look that up using this page.
 * 2) The second parameter is the type that the extension should search for. The extension will search through the   array until it finds an array containing this type. Google uses types contained in this list.
 * 3) (optional) The third parameter is the field (array key) that the extension should search for, within the array that matches the type that was requested. That is usually either   or  . If omitted, the extension will just pick the first value - usually.

Examples

 * → United States
 * → US
 * → United States
 * → San Francisco
 * → SF

Limitations

 * It should be made more secure, with certificates.
 * Caching should be made optional.
 * Not all responses from Google (such as responses which are arrays) are easily accessible yet.