MatanYadaev / laravel-eloquent-spatial

Laravel Eloquent spatial package.
MIT License
328 stars 48 forks source link

new Point(lat,lng) always gets reversed ; 🥲 #90

Closed musabgaili closed 1 year ago

musabgaili commented 1 year ago

Hi , while inserting data to point i noticed my polygons gets rendered in wrong part of map , then i found this ' new LineString([ new Point(23.455363273620605, 45.82746723286806), new Point(23.450309991836548, 45.826636872349075), new Point(23.445632219314575, 45.82197359839437), new Point(23.455363273620605, 45.82746723286806), ]); ' the above code is actually returning the next {"type":"LineString", "coordinates":[ [45.82746723286806,23.455363273620605],[45.82663687234908,23.450309991836548],[45.82197359839437,23.445632219314575],[45.82746723286806,23.455363273620605]]}

which is totally wrong, i temporally fixed it by swapping lats and lngs locations , but it needs to be fixed ,

thank you for your work;;; 🥳

rolfvandekrol commented 1 year ago

The Point class expects the arguments in the order latitude, longitude.

The output however is GeoJSON and outputs positions always in the order longitude, latitude (see https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.1 for the specs on this).

So this might be a little confusing, but it is actually correct.

muxab commented 1 year ago

oh,, thank you .. now i understand that