Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/Types/Point.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use GeoJson\GeoJson;
use GeoJson\Geometry\Point as GeoJsonPoint;
use Grimzy\LaravelMysqlSpatial\Exceptions\InvalidGeoJsonException;

class Point extends Geometry
class Point extends Geometry implements \JsonSerializable
{
protected $lat;

Expand Down Expand Up @@ -92,8 +91,14 @@ public static function fromJson($geoJson)
*
* @return \GeoJson\Geometry\Point
*/
public function jsonSerialize()
public function jsonSerialize(): array
{
return new GeoJsonPoint([$this->getLng(), $this->getLat()]);
return [
'type' => 'Point',
'coordinates' => [
$this->getLng(),
$this->getLat()
]
];
}
}