geocoder-php / Geocoder

The most featured Geocoder library written in PHP.
https://geocoder-php.org
MIT License
3.95k stars 519 forks source link

Coordinates toArray should return Lat then Long #1232

Closed Aporie closed 4 months ago

Aporie commented 4 months ago

I'm not sure if that was intended and if there is a reason for that, but by convention, Latitudes are always first and then Longitude should come.

The first number in GPS coordinates is always the latitude, while the second number represents the longitude.

geocoder/Model/Coordinates.php:toArray should be:

/**
  * Returns the coordinates as a tuple.
  *
  * @return array
  */
public function toArray(): array
{
   return [$this->getLatitude(), $this->getLongitude()];
}
mtmail commented 4 months ago

but by convention, Latitudes are always first and then Longitude should come.

It kind of depends if one has a math background or cartographic background. There is no standard among spatial software, see https://macwright.com/lonlat/

Aporie commented 4 months ago

Interesting feedback.

I indeed have a geological (and cartographic background), so I guess I just preached for one's own parish.

I understand why long / lat might be preferred for people with math background as it's related to cartesian coordinate system.

Well, I don't know. I'm closing the ticket then.

Thanks for the explanation.