diff --git a/src/Types/Point.php b/src/Types/Point.php index d424ec5e..c95fcc09 100644 --- a/src/Types/Point.php +++ b/src/Types/Point.php @@ -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; @@ -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() + ] + ]; } }