CoolCMS API

GoogleMapsLinks
in package

FinalYes

Addresses of the Google Maps pages the site links to or embeds.

The embedded map (Maps Embed API, <iframe>) is free and unlimited, unlike the dynamic JavaScript map — so it is what the site uses wherever a map only shows one place. Coordinates win over the address (they are exact); with neither, no address is built.

Table of Contents

Constants

DEFAULT_ZOOM  : int = 15
EMBED_URL  : string = 'https://www.google.com/maps/embed/v1/place'
MAP_TYPES  : array<string|int, mixed> = ['roadmap', 'satellite']
Map types the Embed API accepts (`roadmap` is its default).
SEARCH_URL  : string = 'https://www.google.com/maps/search/'

Methods

embedUrl()  : string|null
`<iframe src>` of the embedded map, or null without an API key or a place.
openUrl()  : string|null
„Open in Google Maps" — needs no key; null without a place.
coordinate()  : string
Locale-independent decimal with a dot and no trailing zeros.
place()  : string|null
`lat,lng` when both are valid coordinates, else the trimmed address, else null.

Constants

EMBED_URL

private string EMBED_URL = 'https://www.google.com/maps/embed/v1/place'

MAP_TYPES

Map types the Embed API accepts (`roadmap` is its default).

private array<string|int, mixed> MAP_TYPES = ['roadmap', 'satellite']

SEARCH_URL

private string SEARCH_URL = 'https://www.google.com/maps/search/'

Methods

embedUrl()

`<iframe src>` of the embedded map, or null without an API key or a place.

public static embedUrl(string|null $apiKey, float|null $latitude, float|null $longitude[, string|null $address = null ][, string $language = '' ][, int $zoom = self::DEFAULT_ZOOM ][, string $mapType = 'roadmap' ]) : string|null
Parameters
$apiKey : string|null
$latitude : float|null
$longitude : float|null
$address : string|null = null
$language : string = ''

Language code of the page (cs, en, sk); anything unusable is left out

$zoom : int = self::DEFAULT_ZOOM
$mapType : string = 'roadmap'
Return values
string|null

openUrl()

„Open in Google Maps" — needs no key; null without a place.

public static openUrl(float|null $latitude, float|null $longitude[, string|null $address = null ]) : string|null
Parameters
$latitude : float|null
$longitude : float|null
$address : string|null = null
Return values
string|null

coordinate()

Locale-independent decimal with a dot and no trailing zeros.

private static coordinate(float $value) : string
Parameters
$value : float
Return values
string

place()

`lat,lng` when both are valid coordinates, else the trimmed address, else null.

private static place(float|null $latitude, float|null $longitude, string|null $address) : string|null
Parameters
$latitude : float|null
$longitude : float|null
$address : string|null
Return values
string|null
On this page

Search results