bradcornford / Googlmapper

An easy way to integrate Google Maps with Laravel
MIT License
464 stars 142 forks source link

Location geodecoding and creating map #277

Closed popovoleksandr closed 4 years ago

popovoleksandr commented 6 years ago

Hi could you please advise me: I'm running following code Mapper::location('Kiev')->map(['zoom' => 15, 'center' => true, 'marker' => true]); and for some reason getting following https://www.google.com/maps/@50,-179,15z?hl=en-GB (while Mapper::location('Kiev') gives me correct coordinates for Kiev).

Thanks!

popovoleksandr commented 6 years ago

Found workaround:

Reason that library gives me coordinates with local decimal point (in my case it is 'comma' or ',') which will not work as Google (as I understand requires decimal point to be a dot or '.').

Thus workaround as for now is to replace in both coordinates decimal point and then pass it to Mapper:

$location = Mapper::location($address);
$longitude = str_replace(',','.', $location->getLongitude());
$latitude = str_replace(',','.', $location->getLatitude());
Mapper::map($latitude, $longitude);

Can it be solved in future?

bradcornford commented 6 years ago

Hi there,

This sounds like some kind of localisation issues, have you tried updating the configuration for language to your locale?


    |--------------------------------------------------------------------------
    | Language
    |--------------------------------------------------------------------------
    |
    | The Language Google API should use required in ISO 639-1 code format.
    |
    */
    'language' => 'en-gb',```