xref: /webtrees/app/Module/EsriMaps.php (revision d11be7027e34e3121be11cc025421873364403f9)
1c9c6f2ecSGreg Roach<?php
2c9c6f2ecSGreg Roach
3c9c6f2ecSGreg Roach/**
4c9c6f2ecSGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
6c9c6f2ecSGreg Roach * This program is free software: you can redistribute it and/or modify
7c9c6f2ecSGreg Roach * it under the terms of the GNU General Public License as published by
8c9c6f2ecSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9c9c6f2ecSGreg Roach * (at your option) any later version.
10c9c6f2ecSGreg Roach * This program is distributed in the hope that it will be useful,
11c9c6f2ecSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12c9c6f2ecSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13c9c6f2ecSGreg Roach * GNU General Public License for more details.
14c9c6f2ecSGreg Roach * You should have received a copy of the GNU General Public License
15c9c6f2ecSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16c9c6f2ecSGreg Roach */
17c9c6f2ecSGreg Roach
18c9c6f2ecSGreg Roachdeclare(strict_types=1);
19c9c6f2ecSGreg Roach
20c9c6f2ecSGreg Roachnamespace Fisharebest\Webtrees\Module;
21c9c6f2ecSGreg Roach
22c9c6f2ecSGreg Roachuse Fisharebest\Webtrees\I18N;
23c9c6f2ecSGreg Roach
24c9c6f2ecSGreg Roach/**
25c9c6f2ecSGreg Roach * Class EsriMaps - use maps within webtrees
26c9c6f2ecSGreg Roach */
27c9c6f2ecSGreg Roachclass EsriMaps extends AbstractModule implements ModuleMapProviderInterface
28c9c6f2ecSGreg Roach{
29c9c6f2ecSGreg Roach    use ModuleMapProviderTrait;
30c9c6f2ecSGreg Roach
31c9c6f2ecSGreg Roach    /**
32c9c6f2ecSGreg Roach     * Name of the map provider.
33c9c6f2ecSGreg Roach     *
34c9c6f2ecSGreg Roach     * @return string
35c9c6f2ecSGreg Roach     */
36c9c6f2ecSGreg Roach    public function title(): string
37c9c6f2ecSGreg Roach    {
389fb58c9eSGreg Roach        return /* I18N: Name of a mapping organisation */ I18N::translate('Esri/ArcGIS');
39c9c6f2ecSGreg Roach    }
40c9c6f2ecSGreg Roach
41c9c6f2ecSGreg Roach    /**
42c9c6f2ecSGreg Roach     * Name of the map provider.
43c9c6f2ecSGreg Roach     *
44c9c6f2ecSGreg Roach     * @return string
45c9c6f2ecSGreg Roach     */
46c9c6f2ecSGreg Roach    public function description(): string
47c9c6f2ecSGreg Roach    {
48c9c6f2ecSGreg Roach        $link = '<a href="https://maps.esri.com" dir="ltr">maps.esri.com</a>';
49c9c6f2ecSGreg Roach
50c9c6f2ecSGreg Roach        // I18N: %s is a link/URL
51c9c6f2ecSGreg Roach        return I18N::translate('Create maps using %s.', $link);
52c9c6f2ecSGreg Roach    }
53c9c6f2ecSGreg Roach
54c9c6f2ecSGreg Roach    /**
55c9c6f2ecSGreg Roach     * Should this module be enabled when it is first installed?
56c9c6f2ecSGreg Roach     *
57c9c6f2ecSGreg Roach     * @return bool
58c9c6f2ecSGreg Roach     */
59c9c6f2ecSGreg Roach    public function isEnabledByDefault(): bool
60c9c6f2ecSGreg Roach    {
61c9c6f2ecSGreg Roach        return false;
62c9c6f2ecSGreg Roach    }
63c9c6f2ecSGreg Roach
64c9c6f2ecSGreg Roach    /**
65c9c6f2ecSGreg Roach     * Parameters to create a TileLayer in LeafletJs.
66c9c6f2ecSGreg Roach     *
67c9c6f2ecSGreg Roach     * @return array<object>
68c9c6f2ecSGreg Roach     */
69c9c6f2ecSGreg Roach    public function leafletJsTileLayers(): array
70c9c6f2ecSGreg Roach    {
71c9c6f2ecSGreg Roach        return [
72c9c6f2ecSGreg Roach            (object) [
73c9c6f2ecSGreg Roach                'attribution' => 'Tiles ©Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012',
74c9c6f2ecSGreg Roach                'default'     => true,
75c9c6f2ecSGreg Roach                'label'       => 'WorldStreetMap',
76ca91f642SDavid Drury                'maxZoom'     => 17,
77c9c6f2ecSGreg Roach                'minZoom'     => 2,
78a67f33a0SDavid Drury                'url'         => 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}',
79c9c6f2ecSGreg Roach            ],
80c9c6f2ecSGreg Roach            (object) [
81c9c6f2ecSGreg Roach                'attribution' => 'Tiles ©Esri &mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community',
82c9c6f2ecSGreg Roach                'default'     => false,
83c9c6f2ecSGreg Roach                'label'       => 'WorldTopoMap',
84ca91f642SDavid Drury                'maxZoom'     => 17,
85c9c6f2ecSGreg Roach                'minZoom'     => 2,
86a67f33a0SDavid Drury                'url'         => 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}',
87a67f33a0SDavid Drury            ],
88a67f33a0SDavid Drury            (object) [
89a67f33a0SDavid Drury                'attribution' => 'Tiles &copy; Esri &mdash; National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC',
90a67f33a0SDavid Drury                'default'     => false,
91a67f33a0SDavid Drury                'label'       => 'NatGeoWorldMap',
92a67f33a0SDavid Drury                'maxZoom'     => 12,
93a67f33a0SDavid Drury                'minZoom'     => 2,
94a67f33a0SDavid Drury                'url'         => 'https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}',
95c9c6f2ecSGreg Roach            ],
96c9c6f2ecSGreg Roach        ];
97c9c6f2ecSGreg Roach    }
98c9c6f2ecSGreg Roach}
99