From 30fc4926c429ed11f3d5b19b2326145224c13847 Mon Sep 17 00:00:00 2001 From: philipp lang Date: Tue, 9 Jul 2024 17:02:04 +0200 Subject: [PATCH] Add imageUrl and markerUrl --- src/Point.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Point.php b/src/Point.php index 271a77e..5a3078d 100644 --- a/src/Point.php +++ b/src/Point.php @@ -9,4 +9,22 @@ class Point extends Data public function __construct(public float $lat, public float $lon) { } + + public function imageUrl(): string + { + return '/osm-static-maps/?' . http_build_query([ + 'center' => $this->lon . ',' . $this->lat, + 'zoom' => 20, + 'maxZoom' => 13, + ]); + } + + public function markerUrl(): string + { + return '/osm-static-maps/?' . http_build_query([ + 'geojson' => json_encode(['type' => 'Point', 'coordinates' => [$this->lon, $this->lat]]), + 'zoom' => 20, + 'maxZoom' => 18, + ]); + } }