Lue dans les fichiers PHP du paquet au commit 4f3fa313c6b2 : 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é.
OpenStreetMapFactoryclassOpenStreetMap, from its options:
14 options · 1 method · 3 constants
OpenStreetMapProviderclassOpenStreetMap: the live map drawn by Leaflet (assets/leaflet.js) over a tile server, a view as an image made on the server from the same tiles (Static\TileStitcher: fetched with the application's User-Agent, kept as long as the server's Cache-Control allows), and geocoding through geocoder-php's Nominatim provider (one call a second at most, answers kept).
15 methods · 1 constant
Omnimap\OpenStreetMap
OpenStreetMapFactory class
final class OpenStreetMapFactory extends ProviderFactory OpenStreetMapFactory.php:33
OpenStreetMap, from its options:
tiles the tile URL, {z}/{x}/{y} in it (and {s} for a server's subdomains). The default is the OpenStreetMap Foundation's server, whose policy allows normal viewing and forbids heavy use: in production, a tile provider of your own choice or your own server attribution as HTML, shown on the map (the data's licence requires it) max_zoom 19 tile_size 256 user_agent the application's name and a contact, sent with every request the server makes (tiles, Nominatim): required by both policies - a library's default User-Agent is blocked referer sent with them too, when set nominatim the geocoder's URL (https://nominatim.openstreetmap.org); empty: no geocoding nominatim_interval seconds between two geocoder calls of a process (1: "an absolute maximum of 1 request per second") leaflet_script, leaflet_style, leaflet_script_integrity, leaflet_style_integrity where the browser gets Leaflet (unpkg, 1.9.4, with its hashes): serve your own copy to keep the visitor's browser off a CDN background the colour above and below the world on an image made of tiles
Options
| Option | Default | |
|---|---|---|
tiles | self::OSM_TILES | |
attribution | self::OSM_ATTRIBUTION | |
max_zoom | 19 | |
tile_size | 256 | |
user_agent | '' | |
referer | '' | |
nominatim | self::NOMINATIM | |
nominatim_interval | 1.0 | |
geocoder_ttl | 2592000 | |
leaflet_script | 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.js' | |
leaflet_script_integrity | 'sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=' | |
leaflet_style | 'https://unpkg.com/leaflet@1.9.4/dist/leaflet.css' | |
leaflet_style_integrity | 'sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=' | |
background | '#aad3df' |
const OSM_TILES = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'const OSM_ATTRIBUTION = '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'const NOMINATIM = 'https://nominatim.openstreetmap.org'
OpenStreetMapFactory::__construct()
public function __construct(readonly ?HttpClientInterface $http = null, readonly ?ClientInterface $psr18 = null, readonly ?CacheInterface $cache = null)OpenStreetMapProvider class
final class OpenStreetMapProvider implements MapRendererInterface, StaticMapInterface, GeocoderInterface, TileSourceInterface OpenStreetMapProvider.php:32
OpenStreetMap: the live map drawn by Leaflet (assets/leaflet.js) over a tile server, a view as an image made on the server from the same tiles (Static\TileStitcher: fetched with the application's User-Agent, kept as long as the server's Cache-Control allows), and geocoding through geocoder-php's Nominatim provider (one call a second at most, answers kept).
Nothing of a view's options is OpenStreetMap's own but MapView::options('openstreetmap')['map'] - Leaflet's map options, as JSON.
const SUBDOMAINS = ['a', 'b', 'c']What {s} of a tile URL stands for: Leaflet's default subdomains.
OpenStreetMapProvider::__construct()
public function __construct(readonly string $tiles = OpenStreetMapFactory::OSM_TILES, readonly string $attribution = OpenStreetMapFactory::OSM_ATTRIBUTION, readonly int $maxZoom = 19, readonly int $tileSize = 256, readonly ?string $userAgent = null, readonly ?string $referer = null, readonly array $leaflet = [], readonly string $background = '#aad3df', readonly ?HttpClientInterface $http = null, readonly ?CacheInterface $cache = null, readonly ?GeocoderPhp $geocoder = null)OpenStreetMapProvider::getName()
public function getName(): stringOpenStreetMapProvider::getTitle()
public function getTitle(): stringOpenStreetMapProvider::capabilities()
public function capabilities(): CapabilitiesOpenStreetMapProvider::describe()
public function describe(MapView $view): arrayOpenStreetMapProvider::fingerprint()
public function fingerprint(MapView $view): stringOpenStreetMapProvider::attribution()
public function attribution(): stringOpenStreetMapProvider::image()
public function image(MapView $view, Size $size, int $scale = 1): ImageOpenStreetMapProvider::template()
public function template(): stringOpenStreetMapProvider::url()
public function url(int $zoom, int $x, int $y): stringOpenStreetMapProvider::tileSize()
public function tileSize(): intOpenStreetMapProvider::maxZoom()
public function maxZoom(): intOpenStreetMapProvider::headers()
public function headers(): arrayThe User-Agent the policy asks for (none: refused here rather than blocked there), and the Referer when set.
OpenStreetMapProvider::geocode()
public function geocode(string $address, ?string $locale = null, int $limit = 5): arrayOpenStreetMapProvider::reverse()
public function reverse(LatLng $position, ?string $locale = null, int $limit = 5): array