. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Fact; use Fisharebest\Webtrees\I18N; use function view; /** * Class MapLinkOpenStreetMap - show locations in external maps */ class MapLinkOpenStreetMap extends AbstractModule implements ModuleMapLinkInterface { use ModuleMapLinkTrait; /** * Name of the map provider. * * @return string */ protected function providerName(): string { return I18N::translate('OpenStreetMap™'); } /** * @return string */ protected function icon(): string { return view('icons/openstreetmap'); } /** * @param Fact $fact * * @return string */ protected function mapUrl(Fact $fact): string { $latitude = $fact->latitude(); $longitude = $fact->longitude(); // mlat/mlon is the marker position return 'https://www.openstreetmap.org/?mlat=' . $latitude . '&mlon=' . $longitude . '#map=10/' . $latitude . '/' . $longitude; } }