Skip to content

Commit

Permalink
🐛 fix GeoJSON by adding mandatory properties field (#1904)
Browse files Browse the repository at this point in the history
      Co-authored-by: Pascal Weiland <[email protected]>
  • Loading branch information
weiland authored Sep 22, 2023
1 parent 1ea48c2 commit 6eacbd1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/Dto/GeoJson/Feature.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Dto\GeoJson;

use App\Dto\Coordinate;
use stdClass;

class Feature implements \JsonSerializable
{
Expand All @@ -27,6 +28,7 @@ public function toArray(): array {
'type' => $this->type,
'coordinates' => $this->coordinates
],
'properties' => new stdClass(),
];
if ($this->statusId) {
$response['properties'] = ['statusId' => $this->statusId];
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/API/v1/StatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,9 @@ public function getPolyline(string $parameters): JsonResource {
})
->map(function($status) {
return new Feature(
LocationController::forStatus($status)->getMapLines()
LocationController::forStatus($status)->getMapLines(),
'LineString',
$status->id
);
});
$geoJson = new FeatureCollection($geoJsonFeatures);
Expand Down

0 comments on commit 6eacbd1

Please sign in to comment.