laravel-mysql-spatial
laravel-mysql-spatial copied to clipboard
Point toString wrong order
Point toString return lng lat, I think the correct order is lat, lng
Wrong:
public function __toString() { return $this->getLng().' '.$this->getLat(); }
Correct:
public function __toString() { return $this->getLat().' '.$this->getLng(); }
The order of the points coordinates is lng, lat by design (#38, #30). There's also a request to add an option to specify the order (#61) but it just feels like I'd be complicating things.
I'm not sure how to handle this issue.
@grimzy
I got a problem with it. If I use Point(lat, lng):

When I want to query, I got this:

But, If a use lng first:

I got the proper SQL query:

https://dev.mysql.com/doc/refman/5.7/en/gis-point-property-functions.html
Sorry, I realized that this is not a bug. MySQL needs the first longitude and then latitude, it's a standard. In KML files you can realize.