LarsWiegers / laravel-maps

Your laravel maps libary.
https://github.com/LarsWiegers/laravel-maps
MIT License
254 stars 35 forks source link

when supplying centerPoint array in different order, centerPoint coordinates are switched (Leaflet) #13

Closed brausepulver closed 2 years ago

brausepulver commented 2 years ago

When supplying a centerPoint array ordered ['long' => ..., 'lat' => ...] rather than ['lat' => ..., 'long' => ...], the coordinates are switched. This is because of

https://github.com/LarsWiegers/laravel-maps/blob/cd464645e89695871a5a4a06c7213280cb78d519/resources/views/components/leaflet.blade.php#L26

I suggest changing it to var mymap = L.map('{{$mapId}}').setView([{{$centerPoint['lat'] ?? $centerPoint[0]}}, {{$centerPoint['long'] ?? $centerPoint[1]}}], {{$zoomLevel}});

LarsWiegers commented 2 years ago

Hi @brausepulver, thx for creating the issue. Would be cool if you could do a pr and change the code. currently dont have time to do it. maybe next week i have time but not now.

LarsWiegers commented 2 years ago

@brausepulver I created a pr, can you check if it is what you want?

LarsWiegers commented 2 years ago

Its been 2 weeks, merging the pr.