bradcornford / Googlmapper

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

error loading multiple markers #353

Closed jbiddulph closed 4 years ago

jbiddulph commented 4 years ago

Please help, I am getting the following error for each of my map markers:

setLabel: not a string; and no text property

bradcornford commented 4 years ago

Hi,

Could you provide the code you are using so i can take a look.

jbiddulph commented 4 years ago

foreach ($properties as $p) { Mapper::marker($p->latitude, $p->longitude); Mapper::informationWindow($p->latitude, $p->longitude, '<a href="properties/'.$p->id.'/'.$p->slug.'">'.$p->propname.'</a>', ['icon' => ['url' => 'http://moveme.test/logo/primary_map_marker.png', 'scale' => 100]]); }

bradcornford commented 4 years ago

In your example code, an information window also comes with a marker by default, so you dont need to add the marker too.

bradcornford commented 4 years ago

Okay, i've spotted the issue, and published a fix. This should be in current version v3.2.1. You'll also need to re-public the package contents php artisan vendor:publish --provider="Cornford\Googlmapper\MapperServiceProvider" --tag=googlmapper --force

jbiddulph commented 4 years ago

So I finally got round to running the php artisan vendor:publish --provider="Cornford\Googlmapper\MapperServiceProvider" --tag=googlmapper --force as suggested... I am now getting an error 500:

**throw new MapperSearchResponseException('An error occurred performing the location search, the error was:' .

            ' "' . (property_exists($result, 'error_message') ? $result->error_message : 'Unknown') .  '".');**

I am on version 3.2.0

jbiddulph commented 4 years ago

An error occurred performing the location search, the error was: "The provided API key is expired.".

...but I have just created a new google maps API key and added it to vendor/cornfold/googlmapper/config/config.php

I am still getting the message?!

bradcornford commented 4 years ago

You need to add the key to your configuration within config/packages/cornford/googlmapper/config.php

jbiddulph commented 4 years ago

I have regenerated 4 different Google Maps APIs and have a key, I have added the key to the config.php page , still getting error?!

On Sat, 18 Jul 2020 at 18:12, Bradley Cornford notifications@github.com wrote:

You need to add the key to your configuration within config/packages/cornford/googlmapper/config.php

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bradcornford/Googlmapper/issues/353#issuecomment-660512814, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACGYUMBMUYANY5FIECGHM3R4HJYLANCNFSM4LMXJMUA .

-- Sent from Gmail Mobile

jbiddulph commented 4 years ago

Sorted it, I was adding the API key to the wrong confit file

John

On Sat, 18 Jul 2020 at 18:12, Bradley Cornford notifications@github.com wrote:

You need to add the key to your configuration within config/packages/cornford/googlmapper/config.php

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bradcornford/Googlmapper/issues/353#issuecomment-660512814, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACGYUMBMUYANY5FIECGHM3R4HJYLANCNFSM4LMXJMUA .

-- Sent from Gmail Mobile