Aller au contenu

omnimap/google Référence de l’API

Étage
Fournisseur · Omnimap
Version
1.x
Suite de conformité
branchée, CI rouge
Vérifié en réel
Vérifié en partie
Licence
MIT
composer require omnimap/google:1.x-dev

Lue dans les fichiers PHP du paquet au commit 9ce6571c1a62 : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.

Omnimap\Google

  • GoogleFactory class

    Google, from its options:

    8 options · 1 method

  • GoogleProvider class

    Google Maps: the live map (the Maps JavaScript API, drawn by assets/google.js), a view as an image (the Static Maps API, the URL signed with the secret), and geocoding through geocoder-php's GoogleMaps provider.

    11 methods · 2 constants

Omnimap\Google

GoogleFactory class

final class GoogleFactory extends ProviderFactory GoogleFactory.php:29

Google, from its options:

api_key the browser key (Maps JavaScript API), shown in the page server_key the key of the server's calls (Static Maps, Geocoding); the browser key when empty secret the URL signing secret (Static Maps' "signature"; the map cache's names) version the Maps JavaScript API's channel: weekly (the default), quarterly, beta, or a number language, region what the map and the geocoder answer in legacy_signature true: a view is named as glitchr/ux-google named its captures (the pictures kept before omnimap stay valid) geocoder_ttl how long a geocoder's answer is kept, in seconds (30 days)

The HTTP client (Static Maps) and the PSR-18 client (geocoder-php's GoogleMaps provider) are the application's; without them, or without a key (server_key, else api_key), those capabilities are off.

Options

OptionDefault
api_key''
server_key''
secret''
version'weekly'
language''
region''
legacy_signaturefalse
geocoder_ttl2592000

GoogleFactory::__construct()

public function __construct(readonly ?HttpClientInterface $http = null, readonly ?ClientInterface $psr18 = null, readonly ?CacheInterface $cache = null)

GoogleProvider class

final class GoogleProvider implements MapRendererInterface, StaticMapInterface, GeocoderInterface GoogleProvider.php:34

Google Maps: the live map (the Maps JavaScript API, drawn by assets/google.js), a view as an image (the Static Maps API, the URL signed with the secret), and geocoding through geocoder-php's GoogleMaps provider.

Google's own options of a view, under MapView::options('google'): styles list of {name, rules: [{featureType, elementType, stylers: [{color: '#99d7fe'}]}], baseMapTypeId} zoomStyles {default: <style name>, below: {4: <name>, 7: <name>}}: the style shown below each zoom map any other google.maps.MapOptions, as JSON

const STATIC_URL = 'https://maps.googleapis.com/maps/api/staticmap'
const STATIC_MAX = 640

The largest image Static Maps makes, per side, at scale 1.

GoogleProvider::__construct()

public function __construct(readonly ?string $apiKey = null, readonly ?string $serverKey = null, readonly ?string $secret = null, readonly string $version = 'weekly', readonly ?string $language = null, readonly ?string $region = null, readonly bool $legacySignature = false, readonly ?HttpClientInterface $http = null, readonly ?GeocoderPhp $geocoder = null)

GoogleProvider::getName()

public function getName(): string

GoogleProvider::getTitle()

public function getTitle(): string

GoogleProvider::capabilities()

public function capabilities(): Capabilities

GoogleProvider::describe()

public function describe(MapView $view): array

GoogleProvider::fingerprint()

public function fingerprint(MapView $view): string

What a picture of the view depends on. legacy_signature: the text glitchr/ux-google signed (GmObject::getSignatureWithOptions() of a Map built with zoom, center, html2canvas and disableDefaultUI), so the captures it named keep their names; otherwise the view itself, markers and styles included.

GoogleProvider::attribution()

public function attribution(): string

GoogleProvider::image()

public function image(MapView $view, Size $size, int $scale = 1): Image

GoogleProvider::staticUrl()

public function staticUrl(MapView $view, Size $size, int $scale = 1): string

The Static Maps URL of a view: the size clamped to 640 pixels a side, the markers, the default style's rules, the server key, and the signature of the path and query with the secret (Google's "digital signature").

GoogleProvider::geocode()

public function geocode(string $address, ?string $locale = null, int $limit = 5): array

GoogleProvider::reverse()

public function reverse(LatLng $position, ?string $locale = null, int $limit = 5): array