grimzy/laravel-mysql-spatial

Error occurs when Selecting on version 2.2.3 (Binary geometry function st_distance_sphere given two geometries of different srids)

Afnisse opened this issue · 0 comments

  • Library: 2.2.3
  • Laravel: 7.x
  • Mysql 5.7

When I tried to execute this command to get data using Laravel and version 2.2;3

DeliveryPoint::distanceSphereValue($geometryColumn, $geometry)
                ->distanceSphere($geometryColumn, $geometry, $distance)
                ->orderBy('distance', 'desc')
                ->get();

SQL query:

SELECT
	*,
	st_distance_sphere (
		`location`,
	ST_GeomFromText ('POINT(-13.5337661 44.3356798)')) AS distance 
FROM
	`delivery_points`
WHERE
	st_distance_sphere (
		`location`,
	ST_GeomFromText ('POINT(-13.5337661 44.3356798)')) <= 100000000
	AND `delivery_points`.`deleted_at` IS NULL 
ORDER BY
	`distance` DESC

I got this:
Binary geometry function st_distance_sphere given two geometries of different srids: 4326 and 0, which should have been identical., Time: 0.001000s