laravel-mysql-spatial icon indicating copy to clipboard operation
laravel-mysql-spatial copied to clipboard

Point toString wrong order

Open lucabecchetti opened this issue 7 years ago • 3 comments

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(); }

lucabecchetti avatar Nov 28 '18 10:11 lucabecchetti

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 avatar Mar 03 '19 22:03 grimzy

@grimzy

I got a problem with it. If I use Point(lat, lng): imagen

When I want to query, I got this: imagen

But, If a use lng first: imagen

I got the proper SQL query: imagen

https://dev.mysql.com/doc/refman/5.7/en/gis-point-property-functions.html

andreshg112 avatar Apr 26 '19 19:04 andreshg112

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.

andreshg112 avatar May 07 '20 15:05 andreshg112