-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Factory is incorrectly swapping lat/long when creating point #121
Comments
I'll check it out later. Meanwhile, can you please fork this repo, write a failing test that reproduces the bug? It will help me a lot. |
First @MatanYadaev this is a nice package and thank you for this. @MatanYadaev please don't get me wrong, but I need to pinpoint this fundamental problem and potential solution: Industry standard is lat long order. You correctly have this in but then suddenly this order is changed in Point class with these functions:
It should be the opposite i.e.:
I'm writing this based on Point class in the latest release => 4.2.1 |
@MatanYadaev @AlexGodbehere a small update,
Here values were mixed again: Therefore whole package needs to be reviewed again to ensure latitude is always in the first place and longitude second in all classes, methods and variables. If any doubts please check out point implementation on biggest map providers -> Google Maps, Bing Maps, Apple Maps and others... |
Hi @chilio, thanks for the detailed investigation. I'm sorry but I'm not available to investigate it at the moment, will have time in a few days. |
Other then that, I will appreciate if you could push a failing test that will help me reproduce the problem more easily. |
Thanks for diving into this @chilio. I think I understand where the issue is here. My Running the following on the columns sovled this. The map still shows the correct location and this package is happy.
Thanks for this @MatanYadaev - it's a great package. TL;DR; My coordinates were stored in the database in the wrong order. |
Hi @MatanYadaev, you were totally right about GeoJson, WKT, PostGis and others. BTW: Thanks again for your package and sorry for being misleading here. Case closed again. |
I have a
location
column in my table that is a PostGISgeometry
type with SRID 4326 and value0101000020E61000005C8FC2F528544B4094FB1D8A02DD18C0
. It is the location of Belfast Airport. DataGrip confirms this:In the
createFromGeometry()
method ofFactory
the$geoPHPGeometry
object is created, which looks like this:But then, for whatever reason,
Factory
is swapping the two coordinates withreturn new Point($geometry->coords[1], $geometry->coords[0], $srid);
, which results in the incorrect point:Have I discovered a bug or am I missing something?
The text was updated successfully, but these errors were encountered: