Skip to content
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

Recent issues - markers and clustering #34

Closed
kristianharmer opened this issue Jan 20, 2016 · 7 comments
Closed

Recent issues - markers and clustering #34

kristianharmer opened this issue Jan 20, 2016 · 7 comments

Comments

@kristianharmer
Copy link

Hey, I've been having issues recently with this Mapper pacakage.

Firstly, clustering stopped working with my initial implementation, although it had worked fine for weeks until I ran a composer update.

Having updated (cannot remember last version but only 2 months ago) I was gettings errors so tried your examples with info windows and markers. I seem to always get the following JS error no matter what!

ReferenceError: markers_ is not defined
if (markers_.length < this.minClusterSize_) {

Any ideas?

Great package by the way, I was initally up and running in 30 minutes.

@bradcornford
Copy link
Owner

Hi,

Have you run a publish, as the templates have been made accessible for modifications?

php artisan vendor:publish --provider="Cornford\\Googlmapper\\MapperServiceProvider"

@bradcornford
Copy link
Owner

I believe you will have to access the makers via the maps array:

maps[0].makers;

@kristianharmer
Copy link
Author

Hey, thanks for the response :) I did run that publishing command.

Here is what I have in my controller

            $courseMarkers = $region->courses()->get();

            Mapper::map($region->latitude,$region->longitude, ['zoom' => $region->map_zoom, 'center' => true, 'scrollWheelZoom' => false, 'type' => 'ROADMAP']);

            $courseMarkers->each(function($courseMarker)
            {
                if( $courseMarker->latitude != '' && $courseMarker->longitude != '' ) {
                    $content = '<a href="/golf-course/'.$courseMarker->slug.'">'.addslashes($courseMarker->name).'</a>';
                    Mapper::informationWindow($courseMarker->latitude, $courseMarker->longitude, $content);
                }
            });


        return view('region', compact('region', 'courses', 'courseFilter'));

...and this in my view

                        <div id="map">
                            {!! Mapper::render() !!}
                        </div>

Also, I have now tested every release of version 2 and still the same problem so must be my end!

I've tried stripping out content for info windows in case it was a special char issue and also limited the records fetched to just 100 and still the same issue.

Thanks for your time in responding by the way...

@bradcornford
Copy link
Owner

What you have done appears to be correct. What error are you getting? Is it from Google Maps? Or custom JS?

@bradcornford
Copy link
Owner

Actually looking at it, the library used for marker clusters is broken currently, see: googlearchive/js-marker-clusterer#37

There is currently a pull request to fix it:
googlearchive/js-marker-clusterer#39

@kristianharmer
Copy link
Author

Ah that would explain it! Thanks for confirming that. Will hold tight on a fix from that repo :)

Thanks for your help all the same...

@bradcornford
Copy link
Owner

For now, you could change "mapper.blade.php" line 5 to:

<script type="text/javascript" src="https://raw.githubusercontent.com/bradcornford/js-marker-clusterer/gh-pages/src/markerclusterer.js"></script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants